Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';不要在Facebook IOS请求中调用UIView_Ios_Facebook_Ios5_Ios6 - Fatal编程技术网

Can';不要在Facebook IOS请求中调用UIView

Can';不要在Facebook IOS请求中调用UIView,ios,facebook,ios5,ios6,Ios,Facebook,Ios5,Ios6,我在IOS6中有以下设置,可以通过我的应用程序连接到Facebook self.accountStore = [[ACAccountStore alloc] init]; ACAccountType *facebookAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook]

我在IOS6中有以下设置,可以通过我的应用程序连接到Facebook

self.accountStore = [[ACAccountStore alloc] init];

ACAccountType *facebookAccountType = [self.accountStore
                                      accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

// Specify App ID and permissions
NSDictionary *options = @{
                          ACFacebookAppIdKey: @"xxxxxxxxxxxxx",
                          ACFacebookPermissionsKey: @[@"publish_stream", @"publish_actions"],
                          ACFacebookAudienceKey: ACFacebookAudienceFriends
                          };

[accountStore requestAccessToAccountsWithType:facebookAccountType
                                      options:options completion:^(BOOL granted, NSError *e) {
                                          if (granted) {
                                              NSArray *accounts = [self.accountStore
                                                                   accountsWithAccountType:facebookAccountType];
                                              self.facebookAccount = [accounts lastObject];
                                              NSLog(@"Logged In :: %@",self.facebookAccount);

                                              [self uploadVideo];

                                          }
                                          else
                                          {
                                              NSLog(@"Logged In Fail");
                                          }
                                      }];
问题是,我想以UIAlertView的形式提供一些反馈,而else语句就在其中。当我添加以下内容时,应用程序会因EXC\u BAD\u访问而崩溃

UIAlertView *alert = [[UIAlertView alloc]
                      initWithTitle: @"Unable To Connect With Facebook"
                      message: @"xxxxxxxxxxxxx."
                      delegate: nil
                      cancelButtonTitle:@"OK"
                      otherButtonTitles:nil];
[alert show];

如果我只是调用了一个在中没有警报视图的方法,那么它似乎可以正常工作。有人有什么想法吗?

你确定完成块在主线程上吗

尝试将警报视图代码包装到主线程的分派中

dispatch_async(dispatch_get_main_queue(), ^(void) {

});

没有运气尝试将其包装。好的,上面的更新。如果将dispatch\u async放在完成处理程序中,那么它将失败。但是,如果您将dispatch_async放在一个单独的方法中,然后从完成处理程序调用它,那么它就可以工作。谢谢