ios - Facebook login through Safari not using installed App -
i have used facebook sdk facebook developer portal , completed steps written during login through facebook app default uses safari login procedure.
why doesn't use installed app purpose?
try code
-(ibaction)clk_connectwithfb:(id)sender { fbsdkloginmanager *login = [[fbsdkloginmanager alloc] init]; // if facebook app not installed on device, falls \c fbsdkloginbehaviorbrowser. default behavior. login.loginbehavior = fbsdkloginbehaviornative; [login loginwithreadpermissions:@[@"email", @"user_friends",@"user_posts"] handler:^(fbsdkloginmanagerloginresult *result, nserror *error) { if (error) { // process error nslog(@"error :%@",error); } else if (result.iscancelled) { // handle cancellations nslog(@"error :%@",error); } else { if ([result.grantedpermissions containsobject:@"email"]) { [self fetchuserinfo]; [login logout]; } } }]; } -(void)fetchuserinfo { if ([fbsdkaccesstoken currentaccesstoken]) { [[[fbsdkgraphrequest alloc] initwithgraphpath:@"me" parameters:@{@"fields": @"id,name,link,first_name, last_name, picture.type(large), email, birthday, bio ,location ,friends ,hometown ,posts, friendlists"}] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { if (!error) { nslog(@"result :%@",result); nslog(@"friend :%@",[[result valueforkey:@"friends"]objectforkey:@"data"]); nsstring *photostring=[[[result valueforkey:@"picture"] objectforkey:@"data"] valueforkey:@"url"]; photostring = [photostring stringbyreplacingoccurrencesofstring:@"&" withstring:@"%26"]; // [self userlogin:[result valueforkey:@"email"] username:[result valueforkey:@"name"] photourl:photostring logintype:@"fb" phoneno:@""]; } }]; } }
i hope great.
if answer accept , upvote answer
Comments
Post a Comment