ios6 - Want to redirect to setting page of Facebook if no account is configured in iPhone's Settings app -
i'm integrating facebook app uploading video fb. working fine.
acaccountstore *accountstore = [[acaccountstore alloc] init]; acaccounttype *accounttype = [accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifierfacebook]; __block acaccount *facebookaccount; nsdictionary *options = @{ acfacebookappidkey: @"457887770928321", acfacebookpermissionskey: @[@"publish_stream", @"publish_actions"], acfacebookaudiencekey: acfacebookaudiencefriends }; [accountstore requestaccesstoaccountswithtype:accounttype options:options completion:^(bool granted, nserror *error) { if(granted) { nsarray *accountsarray = [accountstore accountswithaccounttype:accounttype]; if ([accountsarray count] > 0) { facebookaccount = [accountsarray objectatindex:0]; nsurl *videourl = [nsurl urlwithstring:@"https://graph.facebook.com/me/videos"]; nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"thaiphuketkaronbeach" oftype:@"mov"]; nsurl *pathurl = [[nsurl alloc]initfileurlwithpath:filepath isdirectory:no]; nsdata *videodata = [nsdata datawithcontentsoffile:filepath]; nsdictionary *params = @{ @"title": @"a video post", @"description": @"me testing video upload facebook." }; slrequest *uploadrequest = [slrequest requestforservicetype:slservicetypefacebook requestmethod:slrequestmethodpost url:videourl parameters:params]; [uploadrequest addmultipartdata:videodata withname:@"source" type:@"video/quicktime" filename:[pathurl absolutestring]]; uploadrequest.account = facebookaccount; nslog(@"uploading..."); [uploadrequest performrequestwithhandler:^(nsdata *responsedata, nshttpurlresponse *urlresponse, nserror *error) { nsstring *responsestring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding]; if(error){ nslog(@"error %@", error.localizeddescription); }else nslog(@"success : %@", responsestring); }]; } else{ // want redirect here settings app } } }];
how can redirect settings app configure fb login if accountsarray count == 0
?
there no api taking user directly fb/tw settings page.
however, slcomposeviewcontroller
prompt user alert if there no account configured set service type (fb/tw/sw). alert has option takes user fb/tw settings screen.
so, if detect there no accounts configured (slcomposeviewcontroller has method this) can present slcomposeviwecontroller knowing prompt user option go settings.
it's not ideal. slcomposeviewcontroller still shows behind alert, , keyboard appears also. it's possible hide these (controller.view.hidden = yes prior presenting, etc.), @ risk isn't expected behavior component.
Comments
Post a Comment