My ionic project crashes on launch every now and then (I’d say approximately one launch on two). I’ve tried to reduce the problem eliminating everything, from css to reducing the project to bare bones, but I am really unable to understand why it crashes.
The application launches normally, but sometimes it doesn’t, and in xcode this is the “stack trace” I’ve got:
(memory bad access)
_objc_msgSend_uncached_impcache _objc_msgSend_uncached_impcache objc_msgSend_corrupt_cache_error
The thread crashing is com.apple.root.default-qos(concurrent)
Profiling the application with Instruments, I found a Zombie:
An Objective-C message was sent to a deallocated ‘UIViewAnimationState’ object (zombie) at address: 0x1701d5810. ￼
Here’s the release/retain cycle that brings to the Zombie object:
# Event Type ∆ RefCt RefCt Timestamp Responsible Library Responsible Caller 0 Malloc +1 1 00:05.870.575 UIKit +[UIViewAnimationState pushViewAnimationState:context:] 1 Retain +1 2 00:05.873.689 QuartzCore CA::AttrList::set(unsigned int, _CAValueType, void const*) 2 Retain +1 3 00:05.873.691 UIKit -[UIViewAnimationState setAnimationAttributes:correctZeroDuration:skipDelegateAssignment:customCurve:] 3 Release -1 2 00:05.874.810 UIKit +[UIViewAnimationState popAnimationState] 4 Release -1 1 00:05.875.046 UIKit +[UIViewAnimationState popAnimationState] Retain/Release (2) 00:05.876.385 Foundation +[NSConcreteNotification newTempNotificationWithName:object:userInfo:] 7 Release -1 0 00:05.876.400 QuartzCore CA::Layer::run_animation_callbacks(void*) 8 Zombie -1 00:07.499.863 QuartzCore CA::release_objects(X::List<void const*>*)
I’ve found a fix here which is to put
[UIView setAnimationsEnabled:NO ]
in your xcode project. However this bug prevents me to use phonegap build, and I’d like to understand what the bug is and what exactly is going on.