我有一個模式視圖控制器,它根據if條件調用viewDidLoad中的另一個模式視圖控制器。當試圖打開每個備用構建的特定模式視圖時,iPhone上的應用程序崩潰
我面對怪異的問題是,我第一次編譯應用程序,並打開第一個模態視圖控制器,它工作正常,並繼續顯示第二視圖控制器。現在,如果我停止應用程序執行並重建&運行該應用程序,則當我打開第一個模式視圖時,該應用程序崩潰(僅凍結主屏幕按鈕)。
這是錯誤我得到:
Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
_Unwind_Resume called from function -[NSArray makeObjectsPerformSelector:] in image CoreFoundation.
2010-09-23 20:19:56.526 MySuperDuperApp[6117:207] CoreAnimation: ignoring exception: [<TwitterLogin 0x7484dc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key actionButton.
TwitterLogin是無法顯示第二模態視圖控制器的名稱。
我試着把NSLogs檢查它到底在哪裏崩潰。
//... part of the method which is called in
// viewDidAppear of first modal view controller.
- (void)login {
NSLog(@"Begin TwitterBasicVC login");
loginPopup = [[TwitterLogin alloc] init];
loginPopup.oAuth = oAuth;
loginPopup.viewDelegate = self;
loginPopup.interfaceDelegate = self;
// Show Login screen.
loginPopup.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
NSLog(@"presenting loginPopup modalView");
[self presentModalViewController:loginPopup animated:YES];
[loginPopup release];
NSLog(@"End TwitterBasicVC login");
//... viewDidLoad of second modal view controller.
- (void)viewDidLoad {
NSLog(@"Begin TwitterLogin viewDidLoad");
[super viewDidLoad];
queue = [[NSOperationQueue alloc] init];
...
在 '呈遞loginPopup modalView' 消息被打印,然而, '開頭TwitterLogin viewDidLoad中' 不打印信息。 我不知道爲什麼它在模態視圖呈現和viewDidLoad之間崩潰。
更奇怪的是,這種情況每隔一段時間就會發生/運行應用程序。 (我試過刪除應用程序並構建它,但它仍然發生)
編輯:我已經添加了登錄方法的第一行,其中twitterLogin是alloc-inited。 我也試着用performSelector:withObject:afterDelay調用值爲0.0和1.0的方法,問題仍然存在。
編輯2:我做每一次我嘗試安裝在iPhone /模擬器的應用程序(刪除從設備/模擬器的應用程序後)一個乾淨的構建。該應用程序似乎正在使用此方法正常工作。我能否認爲在應用商店上傳應用是安全的?
,我應該如何進行調試,將大大幫助我的任何建議:)
感謝
viewDidLoad方法應該在模態的呈現之前被調用(即,當它被分配和初始化時)。你能告訴我們你在哪裏以及如何創建你的loginPopup嗎? – MishieMoo 2010-09-23 15:19:08
不,視圖加載後調用viewDidLoad方法。視圖首先在UIViewController屬性'view'被訪問時加載 - 通常在視圖的控制器被按下或者在這種情況下以模態方式呈現時。 – Michal 2010-09-23 18:40:47