Issue Description
Crash when using animated ImageView with Titanium Mobile SDK 4.1.0.GA. When setting an array of image paths in the TiImageView.images property, the app gets no crash in 4.0.0.GA (iOS simulator/device).
Steps to Reproduce
1. Install attached sample (includes the images)
2. Launch it - the app should crash since 4.1.0.GA and above exhibiting the following outcomes:
iOS 8.4 (iPhone 4s simulator) Crash
iOS 8.2 (iPad) No crash
iOS 7.1 (iPhone) Crash
Stack Trace
Jul 13 18:36:36 lAlO PriebeSandbox[224] <Warning>: [INFO] PriebeSandbox/1.0 (4.1.0.d57aa7d)
Jul 13 18:36:36 lAlO PriebeSandbox[224] <Warning>: [DEBUG] Loading: /var/mobile/Applications/8695F53F-75E4-4328-8C30-C2AC3BD7CE19/PriebeSandbox.app/app.js, Resource: app_js
Jul 13 18:36:36 lAlO PriebeSandbox[224] <Warning>: [DEBUG] Loading: /var/mobile/Applications/8695F53F-75E4-4328-8C30-C2AC3BD7CE19/PriebeSandbox.app/_app_props_.json, Resource: _app_props__json
Jul 13 18:36:37 lAlO PriebeSandbox[224] <Warning>: [ERROR] Script Error {
column = 478;
line = 1;
message = "*** Collection <__NSArrayM: 0x145c0ed0> was mutated while being enumerated.";
sourceURL = "file:///var/mobile/Applications/8695F53F-75E4-4328-8C30-C2AC3BD7CE19/PriebeSandbox.app/app.js";
stack = "[native code]\nglobal code@file:///var/mobile/Applications/8695F53F-75E4-4328-8C30-C2AC3BD7CE19/PriebeSandbox.app/app.js:1:478";
}
Jul 13 18:36:37 lAlO PriebeSandbox[224] <Warning>: [DEBUG] Application booted in 738.143027 ms
Hi, I am having a similar issue. Until now, I still haven't located precisely which piece of code is responsible for the whole crash of the app... The only thing that I am doing is to instantiate a ListView with static content. And I get - sometimes - this error. I am using Ti 4.1.0.GA on iOS 8.3 on the iPad 2 Simulator. [ERROR] The application has crashed with an uncaught exception 'NSGenericException'. [ERROR] Reason: [ERROR] *** Collection <__NSArrayM: 0x7c14a990> was mutated while being enumerated. [ERROR] Stack trace: [ERROR] [ERROR] 0 CoreFoundation 0x052b972a __exceptionPreprocess + 154 [ERROR] 1 libobjc.A.dylib 0x04e8ca97 objc_exception_throw + 44 [ERROR] 2 CoreFoundation 0x052b8fe6 __NSFastEnumerationMutationHandler + 166 [ERROR] 3 Aviation Week Refactor 0x001a8696 DoProxyDelegateReadValuesWithKeysFromProxy + 1110 [ERROR] 4 Aviation Week Refactor 0x001436a1 -[TiUIView readProxyValuesWithKeys:] + 65 [ERROR] 5 Aviation Week Refactor 0x00119f57 -[TiViewProxy firePropertyChanges] + 167 [ERROR] 6 Aviation Week Refactor 0x00117ae2 -[TiViewProxy view] + 706 [ERROR] 7 Aviation Week Refactor 0x0036008d -[TiUIListViewProxy listView] + 45 [ERROR] 8 Aviation Week Refactor 0x00361464 __34-[TiUIListViewProxy setTemplates:]_block_invoke139 + 52
@Matthias Benkort I have exactly the same problem! What I found is that the crash seems to do with *ListView templates*. See my test result matrix below. ||iOS 8.2 simulator||iOS 8.3 simulator|| |ListView not display|Crash| It is happening so randomly - I will open another JIRA with ListView scenario tonight
It needs to be treated urgently! Now I have more places crashing my app due to this unclear problem. *Collection <__NSArrayM: 0x7c14a990> was mutated while being enumerated.*
For the moment, downgrading to 4.0.0.GA solved the issue on my side. So, it's likely to be a regression introduced with 4.1.0.GA. Also, I'm not that sure about the templates. I've tried to put only an empty ListView in an xml view file (I am using Alloy 1.6.2), without any template and It crashed in the exact same way (Maybe because of a default template or something related?) Hope those information will help.
We need this fixed ASAP.
[~KtorZ] [~jialhe85@gmail.com] can someone raise a Jira ticket? It will be difficult to identify the crash scenario you talk about without reproducing the actual error. To be clear, those suffering the ImageView.images crash could use as _Work Around_ setting images array after ImageView creation and remove it from createImageView() instance for now, i.e.
PR: https://github.com/appcelerator/titanium_mobile/pull/6983
PR for 4.1.X https://github.com/appcelerator/titanium_mobile/pull/6984
CR and FT Passed. PRs merged!
Verified fixed, using: MacOS 10.11 Studio 4.2.0.201507201802 Ti SDK 4.1.1.v20150802200935 Appc NPM 4.2.0-1 Appc CLI 4.2.0-1 Ti CLI 4.1.2 Alloy 1.6.2 Node v0.10.37 Java 1.7.0_45 preproduction No crash is witnessed on the sims indicated in the ticket. Images display correctly.