我在 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_BAD_ACCESS 而崩溃
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Unable To Connect With Facebook"
message: @"xxxxxxxxxxxxx."
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
如果我只是调用一个没有警报视图的方法,那么这似乎工作正常。有人有想法么?