1
나는 사용자 데이터가 Appdelegate.mxcode에서 페이스 북 로그인으로 사용자 데이터를 가져 오는 중입니까?
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"email",
@"user_likes",
nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:
if (!error) {
// We have a valid session
NSLog(@"User session found");
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (!error) {
NSLog(@"%@",user);
}}];
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
[[FBSession activeSession] closeAndClearTokenInformation];
break;
default:
break;
}
if (error) {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
}
에서 사용자 세부 루프 를 입력하지 않습니다 즉,하지만 사용자 NSLog의 NSLog을 (찾을 해달라고 얻을 내 app.But 임없는에서 페이스 북의 로그인을 통합 한 @ " % @ ", user) bcoz NSLog (@"User session found ")가 출력됩니다. Y가 맞습니까?
세션을 어떻게 여는 지 보여줄 수 있습니까? (아마도'[FBSession openActiveSessionWithReadPermissions : allowLoginUI : completionHandler :]'와 같은 것일 것입니다. –
내 코드를 수정했습니다. 제발 실수를 저 지르세요. – Sindhia
아무 것도 기록되지 않으면 어떻게 세션이 열렸는지 어떻게 알 수 있습니까? –