if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAcc = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSDictionary *options = @{ (NSString *)ACFacebookAppIdKey: @"##########",
(NSString *)ACFacebookPermissionsKey: [NSArray arrayWithObject:@"email"],
(NSString *)ACFacebookAudienceKey: ACFacebookAudienceEveryone,
};
[accountStore requestAccessToAccountsWithType:facebookAcc options:options completion:^(BOOL granted, NSError *error){
if (granted) {
ACAccount *facebookAccount = [[accountStore accountsWithAccountType:facebookAcc] firstObject];
NSLog(@"facebook usre name: %@, Full name: %@", facebookAccount.username, facebookAccount);
}
else if (error)
NSLog(@"Error occured:%@", [error localizedDescription]);
}];
}
我正在接受 发生错误:Facebook服务器无法满足此访问请求:无效的应用ID 我该怎么写ACFacebookAppIdKey
答案 0 :(得分:1)
转到https://developers.facebook.com/。为iOS创建新的应用程序或选择您的应用程序。在仪表板菜单中,您可以看到您的应用程序ID。您应该将此App ID放入ACFacebookAppIdKey。