Note that there are some explanatory texts on larger screens.

plurals
  1. POLogout using Facebook's official iOS Tutorial
    text
    copied!<p>I'm following Facebook's <a href="http://developers.facebook.com/docs/mobile/ios/build/#logout" rel="nofollow">iOS tutorial for logging out</a>.</p> <p>I added the tutorial's code into my delegate .m file. Ran it and when I clicked on the Logout button, it crashes. I don't know what the error means. The log window shows:</p> <blockquote> <p>[S3DEngine_AppDelegate logoutButtonClicked]: unrecognized selector sent to instance 0xb011dd0</p> </blockquote> <p>I'm using iPhone Simulator 5.0, XCode 4.2. The difference in the tutorial is that I am NOT using <code>applicationDidFinishLauchingWithOptions:</code>. I tried this function too, but it's the same error. </p> <p>Thanks for any help</p> <pre><code>- (void)applicationDidFinishLaunching:(UIApplication *)application { // Facebook // Add the logout button UIButton *logoutButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; logoutButton.frame = CGRectMake(40, 40, 200, 40); [logoutButton setTitle:@"Log Out" forState:UIControlStateNormal]; [logoutButton addTarget:self action:@selector(logoutButtonClicked) forControlEvents:UIControlEventTouchUpInside]; [self.viewController.view addSubview:logoutButton]; // Disable idle timer // [application setIdleTimerDisabled:YES] ; // Configure and start the accelerometer // [[UIAccelerometer sharedAccelerometer] setUpdateInterval:kAccelerometerFrequency] ; [[UIAccelerometer sharedAccelerometer] setDelegate:self] ; // Create the view controller // [window addSubview:viewController.glView]; [window makeKeyAndVisible]; // Configure and start animation // viewController.glView.iAnimationInterval = kAnimationFrequency ; [viewController.glView startAnimation]; // Configure ans start slpash view // CGRect frame = [[UIScreen mainScreen] bounds]; splashView = [[UIImageView alloc] initWithFrame:frame]; splashView.image = [UIImage imageNamed: @"Default.png"]; [window addSubview:splashView]; [window bringSubviewToFront:splashView]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:window cache:YES]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; splashView.alpha = 0.0; [UIView commitAnimations]; // Play default movie if any // [viewController.glView playDefaultMovieIfAny]; facebook = [[Facebook alloc] initWithAppId:@"105441111111111" andDelegate:self]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([defaults objectForKey:@"FBAccessTokenKey"] &amp;&amp; [defaults objectForKey:@"FBExpirationDateKey"]) { facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; } if (![facebook isSessionValid]) { [facebook authorize:nil]; } } - (void) logoutButtonClicked:(id)sender { [facebook logout]; } - (void) fbDidLogout { // Remove saved authorization information if it exists NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([defaults objectForKey:@"FBAccessTokenKey"]) { [defaults removeObjectForKey:@"FBAccessTokenKey"]; [defaults removeObjectForKey:@"FBExpirationDateKey"]; [defaults synchronize]; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload