title: App crashes when i show alert view after successfully granting permissions from Twitter or facebook
body: <p>I am working with Facebook and Twitter for iOS6.
  It is working good. But when I am showing the alert view the app is crashing in both Twitter and Facebook.</p>
  
  <p>Below is the code for Facebook.
  If I comment this line <code>[alert show];</code>  it is working good.
  I do not know where the mistake is.</p>
  
  <pre><code>-(IBAction)signInWithTweetPresses:(id)sender
  {
      if([TWTweetComposeViewController canSendTweet])
      {
  
          self.view.userInteractionEnabled=NO;
          self.navigationController.navigationBar.userInteractionEnabled=NO;
          [self.spinner startAnimating];
  
          NSLog(@"signInWithTweetPresses called");
          ACAccountStore *store = [[ACAccountStore alloc] init];
          ACAccountType *twitterType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
          NSLog(@"store in aap delegate %@ ",store);
          NSLog(@"twittertype in aap delegate %@ ",twitterType);
  
          [store requestAccessToAccountsWithType:twitterType withCompletionHandler:^(BOOL granted, NSError *error) {
              if(granted) {
                  // Remember that twitterType was instantiated above
                  NSArray *twitterAccounts = [store accountsWithAccountType:twitterType];
  
                  //////////////////
                  if ([twitterAccounts count] &gt; 0) {
                      // Grab the initial Twitter account to tweet from.
                      ACAccount *fbAccount = [twitterAccounts objectAtIndex:0];
                      NSLog(@"%@",fbAccount);
                      NSLog(@"accountsArray/loginWithFacebookClicked is    %@",twitterAccounts);
  
                      NSLog(@"username---%@\n accountDescription---%@ \n credential=====%@ \n fbAccount====%@",fbAccount.username,fbAccount.accountDescription, fbAccount.credential,fbAccount);
  
                      NSDictionary *tempDict = [[NSMutableDictionary alloc] initWithDictionary:[fbAccount dictionaryWithValuesForKeys:[NSArray arrayWithObject:@"properties"]]];
                      NSString *tempUserID = [[tempDict objectForKey:@"properties"] objectForKey:@"username"];
                      NSLog(@"tempUserID is  name is      %@",tempUserID);
                      self.emailStr=fbAccount.accountDescription;
                      self.nameForFacebook_String=fbAccount.username;
                      // self.fID_String=fbAccount.identifier;
                      self.fID_String = [NSString stringWithFormat:@"%@", [[fbAccount valueForKey:@"properties"] valueForKey:@"user_id"]] ;
                      NSLog(@"self.fID_String is  idd d is      %@",self.fID_String);
                      appDelegate.isForTwitterAlertBool=YES;
                      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@" " message:@"Successfully Logged in " delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil , nil];
                      [alertView show];
                  }
                  NSLog(@"twitter cata in aap delegate %@ ",twitterAccounts);
  
              }
              else{
                  [self.spinner stopAnimating];
                  self.view.userInteractionEnabled=YES;
                  self.navigationController.navigationBar.userInteractionEnabled=YES;
              }
  
          }];
      }
      else
      {
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No Twitter Accounts" message:@"There are no Twitter accounts configured. You can add or create a Twitter account in Settings." delegate:nil                                                       cancelButtonTitle:@"OK"  otherButtonTitles:nil];
          [alert show];
  
      }
  
  }
  </code></pre>
  
  <p>Code for FaceBook:</p>
  
  <pre><code>-(IBAction)loginWithFacebookClicked:(id)sender
  {
      if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
      {
          self.view.userInteractionEnabled=NO;
          self.navigationController.navigationBar.userInteractionEnabled=NO;
          [self.spinner startAnimating];
          [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sharingStatus) name:ACAccountStoreDidChangeNotification object:nil];
  
          NSLog(@"loginWithFacebookClicked narrrrrrrrrr");
          accountStore = [[ACAccountStore alloc] init];
          // Create an account type that ensures Twitter accounts are retrieved.
          ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
              NSArray * permissions = [NSArray arrayWithObjects:@"email",@"user_location", nil];
          NSDictionary * dict=[NSDictionary dictionaryWithObjectsAndKeys:@"111718528994116",ACFacebookAppIdKey,permissions,ACFacebookPermissionsKey,ACFacebookAudienceEveryone,ACFacebookAudienceKey, nil];
  
          [accountStore requestAccessToAccountsWithType:accountType options:dict completion:^(BOOL granted, NSError *error) {
              if(granted ) {
                  NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
  
                  // You would ideally ask the user which account they want to tweet from, if there is more than one Twitter account present.
                  if ([accountsArray count] &gt; 0) {
                      // Grab the initial Twitter account to tweet from.
                      ACAccount *fbAccount = [accountsArray objectAtIndex:0];
                      NSLog(@"%@",fbAccount);
                      NSLog(@"accountsArray/loginWithFacebookClicked is    %@",accountsArray);
  
                      NSLog(@"username---%@\n accountDescription---%@ \n credential=====%@ \n fbAccount====%@",fbAccount.username,fbAccount.accountDescription, fbAccount.credential,fbAccount);
  
                      NSDictionary *tempDict = [[NSMutableDictionary alloc] initWithDictionary:[fbAccount dictionaryWithValuesForKeys:[NSArray arrayWithObject:@"properties"]]];
                      NSString *tempUserID = [[tempDict objectForKey:@"properties"] objectForKey:@"fullname"];
                      NSLog(@"tempUserID is  name is      %@",tempUserID);
                      self.emailStr=fbAccount.username;
                      self.nameForFacebook_String=tempUserID;
                      // self.fID_String=fbAccount.identifier;
                      self.fID_String = [NSString stringWithFormat:@"%@", [[fbAccount valueForKey:@"properties"] valueForKey:@"uid"]] ;
                      NSLog(@"self.fID_String is  idd d is      %@",self.fID_String);
                      appDelegate.isForFacebookAlertBool=YES;
                      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@" " message:@"Successfully Logged in " delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil , nil];
                      [alertView show];
                  }
              }
              else
              {
                  [self.spinner stopAnimating];
                  self.view.userInteractionEnabled=YES;
                  self.navigationController.navigationBar.userInteractionEnabled=YES;
              }
          }];
  
      }
      else{
  
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No Facebook Accounts" message:@"There are no Facebook accounts configured. You can add or create a Facebook account in Settings." delegate:nil                                                       cancelButtonTitle:@"OK"  otherButtonTitles:nil];
          [alert show];
  
      }
  }
  </code></pre>
  
  <p>Crash Report for Facebook :CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.</p>