2012-10-10 73 views
2

我正在嘗試使用FBUserSettingsViewController,但每次嘗試關閉時都會崩潰。我用下面的代碼來顯示它:FBUserSettingsViewController在關閉時崩潰

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]; 

它顯示正常,但只要我點擊「返回」,我就會崩潰。崩潰是一個EXC_BAD_ACCESS在:

#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 

如果有人能告訴我我搞砸了的東西,那將是巨大的,但是這看起來像在Facebook的SDK中的錯誤。

回答

2

我發現了這個問題。 Facebook編寫了他們的dealloc錯誤。

在FBUserSettingsViewController和FBViewController有dealloc中的如:

- (void)dealloc { 
    [super dealloc]; 

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

這是不對的,[超級的dealloc]應該始終應該被稱爲最後。在嘗試釋放其成員之前,該對象正在被拆除。我改變了順序(dealloc最後),它現在正在工作。我會爲此提出一個錯誤。

+1

我在哪裏可以找到這些文件? – Chris

+0

我也遇到過這個bug,並且按照科林描述的方式修復它。我已將修補程序推送到GitHub的叉子上。請參閱https://github.com/Tafkadasoh/facebook-ios-sdk。 Btw。科林,你的bug提交成功了嗎? FB開發者的任何迴應?看起來有很多錯誤,但他們沒有修復它們中的任何一個: - / – Tafkadasoh