2014-09-22 63 views
1
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我应该写什么来代替ACFacebookAppIdKey?

+0

请让你的问题以良好的格式 – 2014-09-22 10:02:38

回答

1

https://developers.facebook.com/。为iOS创建新的应用程序或选择您的应用程序。在仪表板菜单中,您可以看到您的应用程序ID。您应该将此App ID放到ACFacebookAppIdKey中。

相关问题