2012-05-30 32 views
0

我收到一個NSException,當我點擊我的rightNavButton嘗試打開一個新窗口。但是,當我這樣做時,它突然退出模擬器,並給我一個NSException錯誤。我已經完成了有關該主題的研究並沒有遇到同樣的問題。open({modal:true})拋出NSException

{[ERROR] The application has crashed with an unhandled exception. Stack trace: 
0 CoreFoundation      0x0238c58c __exceptionPreprocess + 156 
1 libobjc.A.dylib      0x024e0313 objc_exception_throw + 44 
2 CoreFoundation      0x02344ef8 +[NSException raise:format:arguments:] + 136 
3 Foundation       0x007313bb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116 
4 UIKit        0x00be51d6 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 290 
5 UIKit        0x009ea65d -[UIViewController presentModalViewController:withTransition:] + 3478 
6 DiscountShelving     0x00198716 -[TiApp attachModal:toController:animated:] + 166 
7 DiscountShelving     0x00198751 -[TiApp attachModal:toController:animated:] + 225 
8 DiscountShelving     0x0019865a -[TiApp showModalController:animated:] + 474 
9 DiscountShelving     0x00063172 -[TiWindowProxy openOnUIThread:] + 2978 
10 Foundation       0x006b594e __NSThreadPerformPerform + 251 
11 CoreFoundation      0x0236d8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
12 CoreFoundation      0x022cb88b __CFRunLoopDoSources0 + 571 
13 CoreFoundation      0x022cad86 __CFRunLoopRun + 470 
14 CoreFoundation      0x022ca840 CFRunLoopRunSpecific + 208 
15 CoreFoundation      0x022ca761 CFRunLoopRunInMode + 97 
16 GraphicsServices     0x041921c4 GSEventRunModal + 217 
17 GraphicsServices     0x04192289 GSEventRun + 115 
18 UIKit        0x00944c93 UIApplicationMain + 1160 
19 DiscountShelving     0x000045da main + 410 
20 DiscountShelving     0x00002ea5 start + 53 
2012-05-30 14:58:46.035 DiscountShelving[19335:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a modal transition from <UINavigationController: 0x6d39e90> to <UINavigationController: 0x6d438d0> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x0238c5a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x024e0313 objc_exception_throw + 44 
    2 CoreFoundation      0x02344ef8 +[NSException raise:format:arguments:] + 136 
    3 Foundation       0x007313bb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116 
    4 UIKit        0x00be51d6 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 290 
    5 UIKit        0x009ea65d -[UIViewController presentModalViewController:withTransition:] + 3478 
    6 DiscountShelving     0x00198716 -[TiApp attachModal:toController:animated:] + 166 
    7 DiscountShelving     0x00198751 -[TiApp attachModal:toController:animated:] + 225 
    8 DiscountShelving     0x0019865a -[TiApp showModalController:animated:] + 474 
    9 DiscountShelving     0x00063172 -[TiWindowProxy openOnUIThread:] + 2978 
    10 Foundation       0x006b594e __NSThreadPerformPerform + 251 
    11 CoreFoundation      0x0236d8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
    12 CoreFoundation      0x022cb88b __CFRunLoopDoSources0 + 571 
    13 CoreFoundation      0x022cad86 __CFRunLoopRun + 470 
    14 CoreFoundation      0x022ca840 CFRunLoopRunSpecific + 208 
    15 CoreFoundation      0x022ca761 CFRunLoopRunInMode + 97 
    16 GraphicsServices     0x041921c4 GSEventRunModal + 217 
    17 GraphicsServices     0x04192289 GSEventRun + 115 
    18 UIKit        0x00944c93 UIApplicationMain + 1160 
    19 DiscountShelving     0x000045da main + 410 
    20 DiscountShelving     0x00002ea5 start + 53 
) 
terminate called after throwing an instance of 'NSException' 
[INFO] Application has exited from Simulator} 

var btnCart = Titanium.UI.createButton({ 
title:'Cart' 
}); 

btnCart.addEventListener('click', function(e){ 
var cartWin = Titanium.UI.createWindow({ 
    url:'../MainWindows/shoppingCart.js', 
    barColor:'12235b', 
    opacity: 1, 
    zIndex: 1 
}); 
cartWin.open({modal:true}); 
}) 

win.rightNavButton = btnCart; 

如果任何機構都知道這個問題,或者已經有它的過去和已固定的:我試圖打開不具有任何錯誤,這是我不斷收到錯誤我的js文件它請儘快讓我知道!

謝謝

+0

能否請你告訴你的代碼? –

+0

@MuhammadZeeshan我在錯誤代碼 –

+0

的底部添加了代碼請參見異常終結應用程序由於未捕獲的異常'NSInternalInconsistencyException',原因:'試圖開始從,而轉換已經在進行中。等待viewDidAppear/viewDidDisappear以知道當前轉換已完成。在我看來,你目前的窗口正在做一些處理。 –

回答

0

我在應用程序中遇到了類似的崩潰。

我只是像實施睡眠方法:

function sleep(milliseconds) 
{ 
    var start = new Date().getTime(); 

    while((new Date().getTime() - start) < milliseconds) 
    { 
     // Do nothing 
    } 
} 

,並打開窗戶像以前一樣把它稱爲:

sleep(1000); 
myWin.open(); 
相關問題