Random crash on tab change
This is more a tip than a question.
My app started crashing -mostly in the simulator- at random moments, usually just after showing the splash screen or changing tabs, no error message or anything shown in Titanium, just "Application exited from simulator". Launching my app in the simulator through XCode, when the crash occured I was getting the following error in the console:
*** -[NSArray initWithObjects:count:]: attempt to insert nil object at objects[6]
I have totally no idea what this means.
Anyway, I was so desperate I had to use my app's backup files from 2 days ago.
Starting with app.js, I started comparing the old and current file. The only difference I spotted was the barImage:'images/nav_bar.png'
in the tabs' windows. I removed these from my current app.js file and suddenly the app stopped crashing.
It seemed so weird I put them back in and the app started crashing again.
I've seen this error showing up to other people in here too (splash-crash error etc), and it seems to be getting fixed with so random solutions.
For me that made the trick. I hope I could help.
1 Answer
-
It's a race condition which I think Appcelerator have fixed in the current dev code. In your case changing that line may have adjusted the timing just enough to stop the bug from triggering, but I don't believe setting the bar image is the root cause. In my app I was frequently able to trigger that bug in the simulator by switching back and forth between windows in a tab group.