Google と SO を検索していますが、com.apple.accounts エラー コード 8 の意味がわかりません。iOS 6 と Facebook SDK を使用しようとしています。
このリクエストを実行します。
if (!_accountStore) _accountStore = [[ACAccountStore alloc] init];
ACAccountType *fbActType = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
(NSString *)ACFacebookAppIdKey, @"###############",
(NSString *)ACFacebookPermissionsKey, [NSArray arrayWithObject:@"email"],
nil];
[_accountStore requestAccessToAccountsWithType:fbActType options:options completion:^(BOOL granted, NSError *error) {
if (granted) {
NSLog(@"Success");
NSArray *accounts = [_accountStore accountsWithAccountType:fbActType];
_facebookAccount = [accounts lastObject];
} else {
NSLog(@"ERR: %@",error);
// Fail gracefully...
}
}
];
次のエラーが表示されます。
ERR: Error Domain=com.apple.accounts Code=8 "The operation couldn’t be completed. (com.apple.accounts error 8.)"
私が何をしても、granted
trueを返すことはありません。どんなアイデアでも大歓迎です。
をバイパスしてif(granted)
この関数を呼び出すと:
- (void)me{
NSLog(@"Home.m - (void)me");
NSURL *meurl = [NSURL URLWithString:@"https://graph.facebook.com/me"];
SLRequest *merequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:meurl
parameters:nil];
merequest.account = _facebookAccount;
[merequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *meDataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"%@", meDataString);
}];
次に、Facebook から返された次の JSON を確認します。
{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}}
更新:したがって、エラーは「クライアントのアクセス情報ディクショナリの値が正しくないか欠落している」ことを意味します。しかし、それが何を意味するのかわかりません。