iphone - Facebook SDK FBLoginView getting EXC_BAD_ACCESS -
i'm following hellofacebooksample project bundled facebook sdk 3.5. i've virtually copied , pasted own app, stuff appdelegate, yet reason clicking login button freezes app. record, authenticates correctly when connecting integrated framework in ios 6, done through fb sdk anyway. it's when try log in using web, i.e. hit fbloginview website opens, authenticated, return app. here code in samepl project, , i'll compare mine:
fbloginview *loginview = [[fbloginview alloc] init]; loginview.frame = cgrectoffset(loginview.frame, 5, 5); loginview.delegate = self; [self.view addsubview:loginview]; [loginview sizetofit];
mine little different:
loginview = [[fbloginview alloc] init]; loginview.delegate = self; [self.facebookcell addsubview:loginview]; [loginview sizetofit];
as delegate methods, i've implemented them verbatim. why app crash? there no valid reason crash when code pretty identical between app , sample app. debugger doesn't zombie objects on. actual error is: thread 1: exc_bad_access (code=2, address=somethingoranother)
got ideas why happening?
regards,
mike
update: appears crash happens because recurring infinitely on loop. seems on 100,000 processes put on main thread fb sdk! how?!
update 2: i'm beginning think error here, though copied straight sample appdelegate.
- (bool)application:(uiapplication *)application openurl:(nsurl *)url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation { // attempt extract token url return [fbappcall handleopenurl:url sourceapplication:sourceapplication fallbackhandler:^(fbappcall *call) { nslog(@"in fallback handler"); }]; }
does @ all?
i'm having whats seems exact problem, have application sandbox mode disabled. app has been working before, upgraded sdk , happens.
if have facebook account configured in ios, work ok, if not, crash. 1 thing worth mentioning if remove url scheme, app can't go web browser or facebook app, user web view log in , works too
edit: far i'm able tell, problem relies in not having access application settings in facebook. facebook sdk [fbutility fetchappsettings:callback:] call, more specifically,
https://graph.facebook.com/267496536695242?fields=supports_attribution,supports_implicit_sdk_logging,suppress_native_ios_gdp,name,
which in case of app fails with:
{ "error": { "message": "unsupported request.", "type": "graphmethodexception", "code": 100 } }
in comparision, of examples apps, example one, sessionloginsample
https://graph.facebook.com/380615018626574?fields=supports_attribution,supports_implicit_sdk_logging,suppress_native_ios_gdp,name
returns correctly this:
{ "supports_attribution": true, "supports_implicit_sdk_logging": true, "suppress_native_ios_gdp": 0, "name": "sessionloginsample", "id": "380615018626574" }
because sdk expects keeps making same request , gets stuck in loop until simulator crashes.
to confirm this, i've manually inserted expected parameters in callback, modifyng facebook sdk, , work perfectly.
it's worth mentioning upgraded sdk 2.0 deprecated, , there few parameters in settings page outdated (no client token set, authorization native/desktop instead web, without having app secret key in app) i've set them alright..
edit 2: method facebook sdk (in fbutility.m) i've modified. added "bad stuff" if clause.
+ (void)fetchappsettings:(nsstring *)appid callback:(void (^)(fbfetchedappsettings *, nserror *))callback { if (!g_fetchedappsettingserror && !g_fetchedappsettings) { nsstring *pingpath = [nsstring stringwithformat:@"%@?fields=supports_attribution,supports_implicit_sdk_logging,suppress_native_ios_gdp,name", appid, nil]; fbrequest *pingrequest = [[[fbrequest alloc] initwithsession:nil graphpath:pingpath] autorelease]; if ([pingrequest startwithcompletionhandler:^(fbrequestconnection *connection, id result, nserror *error) { // bad stuff if (error) { error = nil; result = [nsdictionary dictionarywithobjectsandkeys:@"true", @"supports_attribution", @"true", @"supports_implicit_sdk_logging", @"0", @"suppress_native_ios_gdp", @"your_app_display_name", @"name", nil]; } if (error) { g_fetchedappsettingserror = error; [g_fetchedappsettingserror retain]; } else { g_fetchedappsettings = [[[fbfetchedappsettings alloc] init] retain]; if ([result respondstoselector:@selector(objectforkey:)]) { g_fetchedappsettings.serverappname = [result objectforkey:@"name"]; g_fetchedappsettings.supportsattribution = [[result objectforkey:@"supports_attribution"] boolvalue]; g_fetchedappsettings.supportsimplicitsdklogging = [[result objectforkey:@"supports_implicit_sdk_logging"] boolvalue]; g_fetchedappsettings.suppressnativegdp = [[result objectforkey:@"suppress_native_ios_gdp"] boolvalue]; } } [fbutility callthefetchappsettingscallback:callback]; } ] ); } else { [fbutility callthefetchappsettingscallback:callback]; }
}
Comments
Post a Comment