0
我已經在我的應用程序中使用Facebook登錄並運行良好我正在使用Facebook sdk 3.10,但它只是將我重定向到Web瀏覽器並打開Facebook登錄頁面權限,如果已經存在會話但我不我不想用這種方式,我希望像以前的SDK中的Facebook登錄彈出窗口應該打開,在那裏我填寫我的代碼在下面的憑據請我可以改變這個做同樣的事情。用iPhone在facebook上登錄而不重定向到網絡瀏覽器?
NSArray *permissions =[NSArray arrayWithObjects:@"email",@"user_location",@"user_about_me",@"user_photos",@"xmpp_login", nil];
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error)
{
// if login fails for any reason, we alert
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
else if (FB_ISSESSIONOPENWITHSTATE(status))
{
FBRequest *me = [[FBRequest alloc] initWithSession:session
graphPath:@"me?fields=id,picture.type(large),first_name,last_name,email,gender,birthday,username,hometown"];
[me startWithCompletionHandler:^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *aUser,
NSError *error)
{
fbDetails = [[NSDictionary alloc]init];
fbDetails=[aUser copy];
facebookDetail = [appParser getUserFbDetail:fbDetails];
}];
}
}];
感謝名單了很多@Divya Bhalodiya它的工作,只是一兩件事沒有選擇關閉彈出,如果我要取消登錄時出現任何選項相同 –
@GaganKumar有什麼加載問題點擊左側上角有關閉按鈕,但不幸的是有些時候隱藏。 –
是的,它是thanx那@NitinGohel –