0

我正在使用这段代码:

_accountStore = [ACAccountStore new];

    ACAccountType *facebookTypeAccount =
    [_accountStore accountTypeWithAccountTypeIdentifier:
     ACAccountTypeIdentifierFacebook];

    NSArray *accounts =
    [_accountStore accountsWithAccountType:
     facebookTypeAccount];

    _facebookAccount = [accounts lastObject];

    [_accountStore requestAccessToAccountsWithType:facebookTypeAccount
                                           options:@{ACFacebookAppIdKey:myKey, ACFacebookPermissionsKey:@[@""]}
                                        completion:^(BOOL granted, NSError *error) {
                                            if(granted)
                                            {
                                                NSArray *accounts = [_accountStore accountsWithAccountType:facebookTypeAccount];
                                                _facebookAccount = [accounts lastObject];
                                                NSLog(@"Success");

                                                [self parseUserDataWithCompletion:completion];
                                            }
                                            else
                                            {
                                                NSLog(@"Error: %@", error);

                                                [self parseUserDataWithCompletion:completion];
                                            }
                                        }];

在设备上工作得很好。但是在模拟器上运行会报错:

Error Domain=com.apple.accounts Code=7 "The operation couldn’t be completed. (com.apple.accounts error 7.)"

更新:它也不能在设备上运行。

它曾经工作过。但现在不再...发生了什么事?fb有什么改变吗?

4

1 回答 1

2

解决了。问题是:

ACFacebookPermissionsKey:@[@""]

必须改为

ACFacebookPermissionsKey:@[]
于 2013-05-18T09:47:00.247 回答