open({modal:true})抛出NSException

问题描述:

我收到一个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以知道当前转换已完成。在我看来,你目前的窗口正在做一些处理。 –

我在应用程序中遇到了类似的崩溃。

我只是像实施睡眠方法:

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

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

,并打开窗户像以前一样把它称为:

sleep(1000); 
myWin.open();