开发者

Login into facebook again in WebView after single sign on in Iphone

开发者 https://www.devze.com 2023-03-03 07:54 出处:网络
I am using FB Single sign on for my iphone app. I need to send friend request to a person on facebook through my Iphone app...

I am using FB Single sign on for my iphone app. I need to send friend request to a person on facebook through my Iphone app... As there is no add friend dialog available for iphone..So I am opening in WebView. If My iphone is non multitasking ..then it pop ups d FB login dialog during login time and there is no problem in webview... If its multi tasking..Then i either goes to FB App or 开发者_开发问答to Safari..but in this case when I open FB page in webview..It asks for the credential again.. Is there any way to avoid this problem?


If the app is running a version of iOS that does not support multitasking, the SDK uses the old mechanism of popping up an inline UIWebView, prompting the user to log in and grant access. The FBSessionDelegate is a callback interface that your application should implement: it's methods will be invoked when the application successful login or logout.

you can get rid of SSO editing the source of Facebook.m, just changing one line in the implementation of the authorize:delegate: method by changing [self authorizeWithFBAppAuth:YES safariAuth:YES]; to [self authorizeWithFBAppAuth:NO safariAuth:NO];


Use SSO. Means users logged on to FB on the phone will still be logged on for your app.

The correct way to request a person on fb is here https://developers.facebook.com/docs/reference/dialogs/requests/

FB.ui({method: 'apprequests', message: 'You should learn more about this awesome game.', data: 'tracking information for the user'});


I am not sure if you are already doing this. But what you need to be doing is to store the accessToken that you get from FB in the phone. Later on whenever you open the app, it should be checking for this token and based on it take an action. This is pretty clear in the docs

So essentially you need to be checking for the "accessToken/secret key" before you open the browser view. In the brower view you will pass this accessToken. Take a look at this blog post to get a better understanding of this.

Also to open up the Dialog try using the methods available in Facebook.h

- (void)dialog:(NSString *)action
 andDelegate:(id<FBDialogDelegate>)delegate;

- (void)dialog:(NSString *)action
 andParams:(NSMutableDictionary *)params
 andDelegate:(id <FBDialogDelegate>)delegate;
0

精彩评论

暂无评论...
验证码 换一张
取 消