FBUserSettingsViewController crashes on dismiss

柔情痞子 提交于 2019-12-11 01:47:07

问题


I'm trying to use FBUserSettingsViewController but it's crashing every time I try to dismiss it. I use the following code to display it:

FBUserSettingsViewController *userSettings = [[FBUserSettingsViewController alloc] initWithNibName:nil bundle:nil];
userSettings.readPermissions = @[];
userSettings.publishPermissions = @[@"publish_actions"];
userSettings.defaultAudience = FBSessionDefaultAudienceEveryone;
userSettings.delegate = self;
[self.navigationController pushViewController:userSettings animated:YES];

It displays fine, but as soon as I hit "Back" I get a crash. The crash is an EXC_BAD_ACCESS at:

#0  0x34ae85de in objc_msgSend ()
#1  0x00136916 in -[FBUserSettingsViewController dealloc] at /Users/jacl/src/release/ios-sdk/src/FBUserSettingsViewController.m:86
#2  0x389e29c8 in -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] ()
#3  0x389e249e in -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] ()
#4  0x38978a82 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] ()
#5  0x389ed8ac in -[UIViewAnimationState animationDidStop:finished:] ()
#6  0x331a22e0 in CA::Layer::run_animation_callbacks(void*) ()
#7  0x30fe45da in _dispatch_client_callout ()
#8  0x30fe7e44 in _dispatch_main_queue_callback_4CF ()
#9  0x388c31b0 in __CFRunLoopRun ()
#10 0x3883623c in CFRunLoopRunSpecific ()
#11 0x388360c8 in CFRunLoopRunInMode ()
#12 0x30a3233a in GSEventRunModal ()
#13 0x389b7288 in UIApplicationMain ()
#14 0x00003424 in main at SNIP

If someone could tell me I messed something up, that would be great, but this looks like a bug in the Facebook SDK.


回答1:


I found the issue. Facebook coded their dealloc's wrong.

In FBUserSettingsViewController and FBViewController there are dealloc's such as:

- (void)dealloc {
    [super dealloc];

    [_profilePicture release];
    [_connectedStateLabel release];
    [_me release];
    [_loginLogoutButton release];
    [_permissions release];
    [_backgroundImageView release];
    [_bundle release];
}

This is wrong, [super dealloc] is supposed to always supposed to be called last. The object is being torn down before they try deallocating their members. I switched the order (with dealloc last) and it's now working. I'll be filing a bug on this.



来源:https://stackoverflow.com/questions/12827261/fbusersettingsviewcontroller-crashes-on-dismiss

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!