2
我正在使用下面的api調用來獲取用戶通過Facebook登錄的信息...如何獲取在iOS上通過Facebook登錄的用戶的名字?
首先我稱之爲FBSDKLoginManager的這種方法。
- (void)logInWithReadPermissions:(NSArray *)permissions
fromViewController:(UIViewController *)fromViewController
handler:(FBSDKLoginManagerRequestTokenHandler)handler;
並且一旦登錄成功,我調用下面的方法。
NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
[parameters setValue:@"id,name,email,birthday,gender,education,work" forKey:@"fields"];
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:parameters]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id user, NSError *error) {
if (!error) {
[[CleverTap push] graphUser:user];
}
}];
我的觀點是FBSDK包含一個名爲FBSDKProfile的類。 這有一些屬性,我可以使用像名字中間名和其他。我怎樣才能訪問這.. ..?因爲即使在登錄後,該類的共享實例也不會給我零。
NSLog(@"name %@", [FBSDKProfile currentProfile].firstName);
我在這裏錯過了什麼..?
這工作,但我想以某種方式得到FBSDKProfile對象..但還是謝謝你。 –