My application is crashing whenever I repeatedly open/close Windows.
Basically, a user can click on a row in a table which will call Titanium.UI.createWindow() with a .js file as the url parameter.
If I then navigate back through the top menu, and create another window several times (e.g. 10 times), then the app will crash. This apparently only happens when I switch/create the windows in a fast pace.
The sub window does not do anything fancy, it only displays graphics and text labels, extremely basic.
The stack trace I get is this - problem is I don't really know how to go about troubleshooting this:
Sun Oct 24 20:17:40 maclaptop.local TestApp1[223] <Error>: CGContextConcatCTM: invalid context 0x0 Sun Oct 24 20:17:40 maclaptop.local TestApp1[223] <Error>: CGContextSetInterpolationQuality: invalid context 0x0 Sun Oct 24 20:17:40 maclaptop.local TestApp1[223] <Error>: CGContextDrawImage: invalid context 0x0 Sun Oct 24 20:17:40 maclaptop.local TestApp1[223] <Error>: CGBitmapContextCreateImage: invalid context 0x0 [DEBUG] loading: /Users/wiz/development/titanium/TestApp1/Resources/computer_overview.js, resource: Users/wiz/development/titanium/TestApp1/Resources/computer_overview_js Sun Oct 24 20:17:42 maclaptop.local TestApp1[223] <Error>: CGContextConcatCTM: invalid context 0x0 Sun Oct 24 20:17:42 maclaptop.local TestApp1[223] <Error>: CGContextSetInterpolationQuality: invalid context 0x0 Sun Oct 24 20:17:42 maclaptop.local TestApp1[223] <Error>: CGContextDrawImage: invalid context 0x0 Sun Oct 24 20:17:42 maclaptop.local TestApp1[223] <Error>: CGBitmapContextCreateImage: invalid context 0x0 [DEBUG] loading: /Users/wiz/development/titanium/TestApp1/Resources/computer_overview.js, resource: Users/wiz/development/titanium/TestApp1/Resources/computer_overview_js Sun Oct 24 20:17:45 maclaptop.local TestApp1[223] <Error>: CGContextConcatCTM: invalid context 0x0 Sun Oct 24 20:17:45 maclaptop.local TestApp1[223] <Error>: CGContextSetInterpolationQuality: invalid context 0x0 Sun Oct 24 20:17:45 maclaptop.local TestApp1[223] <Error>: CGContextDrawImage: invalid context 0x0 Sun Oct 24 20:17:45 maclaptop.local TestApp1[223] <Error>: CGBitmapContextCreateImage: invalid context 0x0 Detected an attempt to call a symbol in system libraries that is not present on the iPhone: _Unwind_Resume called from function -[NSDictionary allKeys] in image CoreFoundation. [ERROR] The application has crashed with an unhandled exception. Stack trace: 0 CoreFoundation 0x0380bb7c exceptionPreprocess + 156 1 libobjc.A.dylib 0x0395b40e objc_exception_throw + 47 2 CoreFoundation 0x0375610e -[__NSPlaceholderArray initWithObjects:count:] + 494 3 CoreFoundation 0x037814fa +[NSArray arrayWithObjects:count:] + 74 4 CoreFoundation 0x03794b38 -[NSDictionary allKeys] + 184 5 TestApp1 0x000a1ff9 -[TiProxy allKeys] + 53 6 TestApp1 0x00058b4e -[TiViewProxy firePropertyChanges] + 59 7 TestApp1 0x00058ea5 -[TiViewProxy view] + 507 8 TestApp1 0x0008845d -[TiUITabController loadView] + 155 9 UIKit 0x008de54f -[UIViewController view] + 56 10 UIKit 0x008dc9f4 -[UIViewController contentScrollView] + 42 11 UIKit 0x008ec7e2 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48 12 UIKit 0x008eaea3 -[UINavigationController _layoutViewController:] + 43 13 UIKit 0x008ec12d -[UINavigationController _startTransition:fromViewController:toViewController:] + 524 14 UIKit 0x008e6ccd -[UINavigationController _startDeferredTransitionIfNeeded] + 266 15 UIKit 0x008edd8b -[UINavigationController pushViewController:transition:forceImmediate:] + 876 16 UIKit 0x008e6b67 -[UINavigationController pushViewController:animated:] + 62 17 TestApp1 0x00074cb4 -[TiUITabProxy openOnUIThread:] + 747 18 Foundation 0x005b33ca __NSThreadPerformPerform + 251 19 CoreFoundation 0x037ecfaf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15 20 CoreFoundation 0x0374b39b CFRunLoopDoSources0 + 571 21 CoreFoundation 0x0374a896 __CFRunLoopRun + 470 22 CoreFoundation 0x0374a350 CFRunLoopRunSpecific + 208 23 CoreFoundation 0x0374a271 CFRunLoopRunInMode + 97 24 GraphicsServices 0x053f200c GSEventRunModal + 217 25 GraphicsServices 0x053f20d1 GSEventRun + 115 26 UIKit 0x00842af2 UIApplicationMain + 1160 27 TestApp1 0x000044c9 main + 362 28 TestApp1 0x000032b1 start + 53 2010-10-24 20:17:46.927 TestApp1[223:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSArray initWithObjects:count:]: attempt to insert nil object at objects[8]' *** Call stack at first throw: ( 0 CoreFoundation 0x0380bb99 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0395b40e objc_exception_throw + 47 2 CoreFoundation 0x0375610e -[__NSPlaceholderArray initWithObjects:count:] + 494 3 CoreFoundation 0x037814fa +[NSArray arrayWithObjects:count:] + 74 4 CoreFoundation 0x03794b38 -[NSDictionary allKeys] + 184 5 TestApp1 0x000a1ff9 -[TiProxy allKeys] + 53 6 TestApp1 0x00058b4e -[TiViewProxy firePropertyChanges] + 59 7 TestApp1 0x00058ea5 -[TiViewProxy view] + 507 8 TestApp1 0x0008845d -[TiUITabController loadView] + 155 9 UIKit 0x008de54f -[UIViewController view] + 56 10 UIKit 0x008dc9f4 -[UIViewController contentScrollView] + 42 11 UIKit 0x008ec7e2 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48 12 UIKit 0x008eaea3 -[UINavigationController _layoutViewController:] + 43 13 UIKit 0x008ec12d -[UINavigationController _startTransition:fromViewController:toViewController:] + 524 14 UIKit 0x008e6ccd -[UINavigationController _startDeferredTransitionIfNeeded] + 266 15 UIKit 0x008edd8b -[UINavigationController pushViewController:transition:forceImmediate:] + 876 16 UIKit 0x008e6b67 -[UINavigationController pushViewController:animated:] + 62 17 TestApp1 0x00074cb4 -[TiUITabProxy openOnUIThread:] + 747 18 Foundation 0x005b33ca __NSThreadPerformPerform + 251 19 CoreFoundation 0x037ecfaf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15 20 CoreFoundation 0x0374b39b __CFRunLoopDoSources0 + 571 21 CoreFoundation 0x0374a896 __CFRunLoopRun + 470 22 CoreFoundation 0x0374a350 CFRunLoopRunSpecific + 208 23 CoreFoundation 0x0374a271 CFRunLoopRunInMode + 97 24 GraphicsServices 0x053f200c GSEventRunModal + 217 25 GraphicsServices 0x053f20d1 GSEventRun + 115 26 UIKit 0x00842af2 UIApplicationMain + 1160 27 TestApp1 0x000044c9 main + 362 28 TestApp1 0x000032b1 start + 53 ) terminate called after throwing an instance of 'NSException' [DEBUG] Session did end with error (null)
Any suggestions are welcome.
Thanks!
3 Answers
Also experiencing this issue. Would it be too much to ask for a response?
double post - sorry
attemp to insert nil object at objects[xx] haunted my app too.
For me removing as much code as possible from app.js, making it 'lighter' did the trick. It seems it's some Titanium issue, so I doubt it's a programming problem. If your file does too much work, try removing some of it or doing it in different ways.
I've seen similar errors occuring to other developers in the Q&A as well, and they are most of the times fixed with very random solutions - search around and you might find the solution to your problem.
Your Answer
Think you can help? Login to answer this question!