这种情况非常随机,有时是打开第一个窗口,有时是9个或更多。
从Titanium 3.1升级到3.2后,我发现了这个错误,其中NavigationGroup被NavigationWindow取代。
以下其中一个堆栈跟踪显示:
*** -[__NSArrayM objectAtIndex:]: index 4 beyond bounds [0 .. 1]
[INFO] 2014-01-30 17:03:34.552 myapp[46210:80b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 4 beyond bounds [0 .. 1]'
[INFO] *** First throw call stack:
[INFO] (
[INFO] 0 CoreFoundation 0x0470f5e4 __exceptionPreprocess + 180
[INFO] 1 libobjc.A.dylib 0x042198b6 objc_exception_throw + 44
[INFO] 2 CoreFoundation 0x046b04e6 -[__NSArrayM objectAtIndex:] + 246
[INFO] 3 myapp 0x0007afc0 -[TiViewProxy insertSubview:forProxy:] + 1520
[INFO] 4 myapp 0x0007a8f8 -[TiViewProxy refreshView:] + 2232
[INFO] 5 myapp 0x0007bb53 -[TiViewProxy layoutChildrenIfNeeded] + 259
[INFO] 6 myapp 0x00203927 +[TiLayoutQueue layoutProxy:] + 87
[INFO] 7 myapp 0x002036f2 performLayoutRefresh + 530
[INFO] 8 CoreFoundation 0x046cdbd6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
[INFO] 9 CoreFoundation 0x046cd5bd __CFRunLoopDoTimer + 1181
[INFO] 10 CoreFoundation 0x046b5628 __CFRunLoopRun + 1816
[INFO] 11 CoreFoundation 0x046b4ac3 CFRunLoopRunSpecific + 467
[INFO] 12 CoreFoundation 0x046b48db CFRunLoopRunInMode + 123
[INFO] 13 GraphicsServices 0x049699e2 GSEventRunModal + 192
[INFO] 14 GraphicsServices 0x04969809 GSEventRun + 104
[INFO] 15 UIKit 0x01c32d3b UIApplicationMain + 1225
[INFO] 16 myapp 0x00003558 main + 456
[INFO] 17 libdyld.dylib 0x051f270d start + 1
[INFO] 18 ??? 0x00000001 0x0 + 1
[INFO] )
[INFO] libc++abi.dylib: terminating with uncaught exception of type NSException
或更复杂:
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[9]
[INFO] 2014-01-30 17:17:40.232 myapp[47304:80b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[9]'
[INFO] *** First throw call stack:
[INFO] (
[INFO] 0 CoreFoundation 0x0470f5e4 __exceptionPreprocess + 180
[INFO] 1 libobjc.A.dylib 0x042198b6 objc_exception_throw + 44
[INFO] 2 CoreFoundation 0x046c3316 -[__NSPlaceholderArray initWithObjects:count:] + 390
[INFO] 3 CoreFoundation 0x046c513e -[NSArray initWithArray:range:copyItems:] + 558
[INFO] 4 CoreFoundation 0x046c4f00 -[NSArray initWithArray:copyItems:] + 80
[INFO] 5 CoreFoundation 0x046e718d -[__NSArrayM copyWithZone:] + 77
[INFO] 6 libobjc.A.dylib 0x0422bbc1 -[NSObject copy] + 41
[INFO] 7 UIKit 0x01c9c609 -[UIView(UIViewGestures) gestureRecognizers] + 43
[INFO] 8 UIKit 0x01c97e76 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1176
[INFO] 9 UIKit 0x01c97cd7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 761
[INFO] 10 UIKit 0x01c97cd7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 761
[INFO] 11 UIKit 0x01c97cd7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 761
[INFO] 12 UIKit 0x01c8f500 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 162
[INFO] 13 UIKit 0x01c8f388 -[UIView(Hierarchy) _postMovedFromSuperview:] + 260
[INFO] 14 UIKit 0x01c9a4c1 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1847
[INFO] 15 UIKit 0x01c8d9b1 -[UIView(Hierarchy) addSubview:] + 56
[INFO] 16 UIKit 0x01c29e05 -[_UIParallaxDimmingView didMoveToWindow] + 129
[INFO] 17 UIKit 0x01c98077 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1689
[INFO] 18 UIKit 0x01c97cd7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 761
[INFO] 19 UIKit 0x01c8f500 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 162
[INFO] 20 UIKit 0x01c8f388 -[UIView(Hierarchy) _postMovedFromSuperview:] + 260
[INFO] 21 UIKit 0x01c9a4c1 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1847
[INFO] 22 UIKit 0x01c8d9b1 -[UIView(Hierarchy) addSubview:] + 56
[INFO] 23 UIKit 0x01c26892 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 2001
[INFO] 24 UIKit 0x01c943ef +[UIView(Animation) performWithoutAnimation:] + 82
[INFO] 25 UIKit 0x01c25c96 -[_UINavigationParallaxTransition animateTransition:] + 1155
[INFO] 26 UIKit 0x01d60e4e -[UINavigationController _startCustomTransition:] + 3446
[INFO] 27 UIKit 0x01d6d0c7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
[INFO] 28 UIKit 0x01d6dcb9 -[UINavigationController __viewWillLayoutSubviews] + 57
[INFO] 29 UIKit 0x01ea7181 -[UILayoutContainerView layoutSubviews] + 213
[INFO] 30 UIKit 0x14d0356f -[UILayoutContainerViewAccessibility(SafeCategory) layoutSubviews] + 50
[INFO] 31 UIKit 0x01c9d267 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
[INFO] 32 libobjc.A.dylib 0x0422b81f -[NSObject performSelector:withObject:] + 70
[INFO] 33 QuartzCore 0x0347c2ea -[CALayer layoutSublayers] + 148
[INFO] 34 QuartzCore 0x034700d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
[INFO] 35 QuartzCore 0x0346ff40 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
[INFO] 36 QuartzCore 0x033d7ae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
[INFO] 37 QuartzCore 0x033d8e71 _ZN2CA11Transaction6commitEv + 393
[INFO] 38 QuartzCore 0x033d9544 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
[INFO] 39 CoreFoundation 0x046d74ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
[INFO] 40 CoreFoundation 0x046d741f __CFRunLoopDoObservers + 399
[INFO] 41 CoreFoundation 0x046b5344 __CFRunLoopRun + 1076
[INFO] 42 CoreFoundation 0x046b4ac3 CFRunLoopRunSpecific + 467
[INFO] 43 CoreFoundation 0x046b48db CFRunLoopRunInMode + 123
[INFO] 44 GraphicsServices 0x049699e2 GSEventRunModal + 192
[INFO] 45 GraphicsServices 0x04969809 GSEventRun + 104
[INFO] 46 UIKit 0x01c32d3b UIApplicationMain + 1225
[INFO] 47 myapp 0x00003558 main + 456
[INFO] 48 libdyld.dylib 0x051f270d start + 1
[INFO] 49 ??? 0x00000001 0x0 + 1
[INFO] )
[INFO] libc++abi.dylib: terminating with uncaught exception of type NSException
打开新窗口时执行的功能:
var openingView = false;
Alloy.Globals.open = function(name, args) {
var view;
args = args || {};
if (typeof name === 'string') {
view = Alloy.createController(name, args).getView();
} else if (name.getView) {
view = name.getView();
name = view.id;
}
if (openingView === false) {
openingView = true;
view.addEventListener('focus', function viewFocus(event) {
openingView = false;
view.removeEventListener('focus', viewFocus);
});
if (view) {
if (view.loading) {
view.addEventListener('loaded', function onLoaded() {
Alloy.Globals.nav.openWindow(view);
view.removeEventListener('loaded', onLoaded);
});
} else {
Alloy.Globals.nav.openWindow(view);
}
}
}
};
答案 0 :(得分:0)
很难说没有看到导致崩溃的JS代码,但似乎你试图在数组外部或者在null中访问和对象: - [__ NSArrayM objectAtIndex:]:索引4超出边界[0 .. 1]
尝试在发现崩溃的地方发布代码。