2014-09-22 92 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中。

相關問題