域名:@" com.facebook.sdk" - 使用PFFacebookUtils的代码5错误

时间:2015-06-06 02:48:53

标签: ios objective-c facebook parse-platform

我试图使用以下代码检索Facebook用户好友列表:

FBRequest* friendsRequest = [FBRequest requestForMyFriends];
[friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                              NSDictionary* result,
                                              NSError *error) {
    NSArray* friends = [result objectForKey:@"data"];
    NSLog(@"Found: %i friends", friends.count);
    for (NSDictionary<FBGraphUser>* friend in friends) {
        NSLog(@"I have a friend named %@ with id %@", friend.name, friend.id);
    }
}];

登录Facebook用户已经使用解析&#34; PFFacebookUtils&#34; 从本教程https://parse.com/tutorials/login-and-signup-views

这就是我所做的: 1.配置我的.plist文件。 2.在AppDelegate.m中,我添加了以下方法:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[Parse setApplicationId:@"your_application_id" clientKey:@"your_client_key"];
[PFFacebookUtils initializeFacebook];

}


// Facebook oauth callback
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [PFFacebookUtils handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
 sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [PFFacebookUtils handleOpenURL:url];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
// Handle an interruption during the authorization flow, such as the user clicking the home button.
   [FBAppEvents activateApp];
   [FBSession.activeSession handleDidBecomeActive];
}

3.在logInViewController.m中:

logInViewController.fields = PFLogInFieldsLogInButton |        PFLogInFieldsUsernameAndPassword | PFLogInFieldsFacebook | PFLogInFieldsSignUpButton | PFLogInFieldsPasswordForgotten;
    logInViewController.facebookPermissions = @[ @"public_profile",@"email",@"user_friends"];

我可以成功登录,但是当我检索到用户朋友时,我收到此错误:(注意:我正在使用测试用户并为他们创建好友列表)

enter image description here

请感谢任何帮助。

0 个答案:

没有答案