{ "id": "169898", "key": "TIMOB-25346", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "19906", "description": "", "name": "Release 6.3.0", "archived": false, "released": true, "releaseDate": "2017-11-01" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-10-27T18:36:05.000+0000", "created": "2017-09-26T03:29:43.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "consider-6.2.3", "fireevent", "json", "regression", "tiapp" ], "versions": [ { "id": "19542", "description": "", "name": "Release 6.2.2", "archived": false, "released": true, "releaseDate": "2017-09-19" }, { "id": "18414", "description": "", "name": "Release 6.2.0", "archived": false, "released": true, "releaseDate": "2017-09-13" }, { "id": "19922", "description": "", "name": "Release 6.2.1", "archived": false, "released": true, "releaseDate": "2017-09-18" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-10-30T21:45:54.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Tested same app in 6.1.1. was working fine.\r\nError in titanium 6.2.0 and 6.2.2 sdk.\r\n\r\nHas something significantly changed in how JSON is parsed for Ti.App.fireEvent in 6.2.0 sdk going forward?\r\n\r\nsituation... note no params are provided to the event name.\r\nTi.App.fireEvent(\"my_event_name\");\r\n\r\nThis event is happening as a window closes, so it is hard to replicate.\r\nCould the previous JSON parser handle empty dictionary params but not the new updated version?\r\n\r\nAlternatively, if there is an error in the dictionary, is it that the previous json parser failed gracefully, but the new one causes an app crash?\r\n\r\nTested in iOS simulator and device...\r\n\r\nError log\r\n---\r\n\r\n\r\n[INFO] : Could not parse JSON. Error: Error Domain=NSCocoaErrorDomain Code=3840 \"Badly formed object around character 364.\" UserInfo={NSDebugDescription=Badly formed object around character 364.}\r\n[ERROR] : The application has crashed with an uncaught exception 'NSRangeException'.\r\n[ERROR] : Reason:\r\n[ERROR] : *** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray\r\n[ERROR] : Stack trace:\r\n[ERROR] : 0 CoreFoundation 0x0000000108abdaf3 __exceptionPreprocess + 147\r\n[ERROR] : 1 libobjc.A.dylib 0x000000010807b141 objc_exception_throw + 48\r\n[ERROR] : 2 CoreFoundation 0x0000000108ad527d -[__NSArray0 objectAtIndex:] + 93\r\n[ERROR] : 3 mLearn 0x0000000100fb6001 -[AppModule fireEvent:] + 97\r\n[ERROR] : 4 mLearn 0x0000000100fb64e1 -[AppModule fireEvent:withObject:] + 113\r\n[ERROR] : 5 mLearn 0x0000000100e7f8a1 -[AppProtocolHandler handleAppToTiRequest] + 945\r\n[ERROR] : 6 mLearn 0x0000000100e7fe1c -[AppProtocolHandler startLoading] + 188\r\n[ERROR] : 7 CFNetwork 0x0000000105e3e206 ___ZN16CFURLProtocol_NS28_protocolInterface_startLoadEPK20_CFCachedURLResponse_block_invoke + 303\r\n[ERROR] : 8 libdispatch.dylib 0x000000010ac55792 _dispatch_client_callout + 8\r\n[ERROR] : 9 libdispatch.dylib 0x000000010ac3828d _dispatch_block_invoke_direct + 358\r\n[ERROR] : 10 CFNetwork 0x0000000105dacf88 _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 24\r\n[ERROR] : 11 CoreFoundation 0x0000000108a10be4 CFArrayApplyFunction + 68\r\n[ERROR] : 12 CFNetwork 0x0000000105dace5e _ZN19RunloopBlockContext7performEv + 132\r\n[ERROR] : 13 CFNetwork 0x0000000105daccf8 _ZN17MultiplexerSource7performEv + 282\r\n[ERROR] : 14 CFNetwork 0x0000000105dacb2b _ZN17MultiplexerSource8_performEPv + 65\r\n[ERROR] : 15 CoreFoundation 0x0000000108a63c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17\r\n[ERROR] : 16 CoreFoundation 0x0000000108a490cf __CFRunLoopDoSources0 + 527\r\n[ERROR] : 17 CoreFoundation 0x0000000108a485ff __CFRunLoopRun + 911\r\n[ERROR] : 18 CoreFoundation 0x0000000108a48016 CFRunLoopRunSpecific + 406\r\n[ERROR] : 19 CFNetwork 0x0000000105fc3f6a _ZL27_privateRunloopEmulationSetPv + 250\r\n[ERROR] : 20 libsystem_pthread.dylib 0x000000010afe893b _pthread_body + 180\r\n[ERROR] : 21 libsystem_pthread.dylib 0x000000010afe8887 _pthread_body + 0\r\n[ERROR] : 22 libsystem_pthread.dylib 0x000000010afe808d thread_start + 13\r\n-- End simulator log ---------------------------------------------------------", "attachment": [], "flagged": false, "summary": "iOS: App-crash when using Ti.App.fireEvent to send nested JSON-payload in 6.2.0.GA+", "creator": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "subtasks": [], "reporter": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "environment": "iOS", "comment": { "comments": [ { "id": "428454", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey there, here to help! Would you be able to provide a reproducible test-case? The error is {{Badly formed object around character 364.}} and looks like a malformed JSON payload. If you are able to print your payload, we may be able to track it down.\r\n\r\nSo the JSON-parse-error is thrown from [here|https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/AppModule.m#L205], suggesting that the payload (second parameter, not included in your example, yet, only the event-name by now) could not be serialized (from object to JSON) and then parsed (from JSON to dictionary).", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-26T07:40:06.000+0000", "updated": "2017-09-26T07:51:23.000+0000" }, { "id": "428455", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "payload data is hard to reproduce because it changes, but it looks like this.\r\ncontext is elearning scorm tracks.\r\npayload below...\r\n\r\nIn this context, i am handling client meta data, which sometimes can be malformed.\r\nis there a way to catch and fail gracefully, rather than crash and burn :)\r\n\r\n{\"tracks\":[{\"element\":\"cmi.core.total_time\",\"value\":\"00:02:27.86\"}],\"userdata\":{\"16\":{\"cmi.student_preference.language\":\"\",\"cmi.core._children\":\"student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time\",\"cmi.core.entry\":\"resume\",\"cmi.objectives._children\":\"id,score,status\",\"cmi.core.total_time\":\"00:02:13.25\",\"cmi.core.student_name\":\"Anthony Chung\",\"cmi.core.score.min\":\"\",\"cmi.student_data.mastery_score\":\"\",\"cmi.student_data.time_limit_action\":\"\",\"cmi.core.credit\":\"credit\",\"cmi.core.session_time\":\"0000:00:14.61\",\"cmi.core.lesson_location\":\"index.html#/list/0X1CkVUYKNPDve792clZ4TnlYbPj539b/preview\",\"cmi.objectives._count\":\"0\",\"cmi._children\":\"core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions\",\"cmi.core.score.max\":\"\",\"cmi.suspend_data\":\"{\\\"quizItems\\\":{},\\\"progress\\\":{\\\"V9JVXnfqV_wqghlbKAyvLy7RVYheTWyN\\\":[1,2,3,4,5],\\\"iZHn5EIGvP1ygmJ4PBXaLnfau5-LECH_\\\":[2,3,4,6,7],\\\"0X1CkVUYKNPDve792clZ4TnlYbPj539b\\\":[1]}}\",\"cmi.interactions._children\":\"id,objectives,time,type,correct_responses,weighting,student_response,result,latency\",\"cmi.evaluation.comments._children\":\"content,location,time\",\"cmi.student_preference._children\":\"audio,language,speed,text\",\"cmi.core.score.raw\":\"\",\"cmi.student_data.max_time_allowed\":\"\",\"cmi._version\":\"3.4\",\"cmi.comments\":\"\",\"cmi.student_preference.text\":\"0\",\"cmi.launch_data\":\"scormdriver/indexAPI.html\",\"cmi.interactions._count\":\"0\",\"cmi.evaluation.comments._count\":\"0\",\"cmi.core.lesson_mode\":\"normal\",\"cmi.core.exit\":\"suspend\",\"cmi.student_preference.speed\":\"0\",\"cmi.student_preference.audio\":\"0\",\"cmi.core.score._children\":\"raw,min,max\",\"nav.event\":\"\",\"cmi.core.lesson_status\":\"incomplete\",\"cmi.student_data._children\":\"mastery_score,max_time_allowed,time_limit_action\",\"cmi.core.student_id\":\"Anthony Chung\"}},\"scoid\":16,\"attempt\":1,\"offline\":false,\"type\":\"app:fromWebView:scorm\",\"name\":\"save_tracks\"}", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-26T07:54:09.000+0000", "updated": "2017-09-26T07:54:09.000+0000" }, { "id": "428456", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "previous version of titanium looks it fails gracefully. perhaps new json parse mechanism?", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-26T07:55:10.000+0000", "updated": "2017-09-26T07:55:10.000+0000" }, { "id": "428457", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Well, we moved from an third-party library that did the JSON-parsing to the iOS-provided API which is more performant and up-to-date. So you are sending the event from a Ti.UI.WebView to be received by your app? If you can, send me the payload AND error (e.g. {{Badly formed object around character 364}}, so we can track down the character that is bugging it. Because it worked before, the proposed solution should be making it backwards-compatible instead of just ignoring it. Let me know if you can provide the above combination and thanks already for the feedback!\r\n\r\n*EDIT*: Saw your last comment. So it failed in previous versions as well, but without a crash? If so, we can fix that easily. Let me know!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-26T08:08:41.000+0000", "updated": "2017-09-26T08:22:49.000+0000" }, { "id": "428458", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "sorry, to clarify, it works in previous versions.\r\n\r\nwhen i switch to 6.2.2. the app crashes with the previous type of error without showing the payload...\r\n\r\nthese are the 2 payloads you can test with when i switch back to 6.1.1, put these as the params next to the fireevent name \"app:fromWebView:scorm\". \r\n\r\n{\"tracks\":[{\"element\":\"cmi.suspend_data\",\"value\":\"{\\\"quizItems\\\":{},\\\"progress\\\":{\\\"V9JVXnfqV_wqghlbKAyvLy7RVYheTWyN\\\":[1,2,3,4,5],\\\"iZHn5EIGvP1ygmJ4PBXaLnfau5-LECH_\\\":[2,3,4,6,7],\\\"0X1CkVUYKNPDve792clZ4TnlYbPj539b\\\":[1]}}\"}],\"userdata\":{\"16\":{\"cmi.student_preference.language\":\"\",\"cmi.core._children\":\"student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time\",\"cmi.core.entry\":\"resume\",\"cmi.objectives._children\":\"id,score,status\",\"cmi.core.total_time\":\"00:02:13.25\",\"cmi.core.student_name\":\"Anthony Chung\",\"cmi.core.score.min\":\"\",\"cmi.student_data.mastery_score\":\"\",\"cmi.student_data.time_limit_action\":\"\",\"cmi.core.credit\":\"credit\",\"cmi.core.session_time\":\"0000:00:14.61\",\"cmi.core.lesson_location\":\"index.html#/list/0X1CkVUYKNPDve792clZ4TnlYbPj539b/preview\",\"cmi.objectives._count\":\"0\",\"cmi._children\":\"core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions\",\"cmi.core.score.max\":\"\",\"cmi.suspend_data\":\"{\\\"quizItems\\\":{},\\\"progress\\\":{\\\"V9JVXnfqV_wqghlbKAyvLy7RVYheTWyN\\\":[1,2,3,4,5],\\\"iZHn5EIGvP1ygmJ4PBXaLnfau5-LECH_\\\":[2,3,4,6,7],\\\"0X1CkVUYKNPDve792clZ4TnlYbPj539b\\\":[1]}}\",\"cmi.interactions._children\":\"id,objectives,time,type,correct_responses,weighting,student_response,result,latency\",\"cmi.evaluation.comments._children\":\"content,location,time\",\"cmi.student_preference._children\":\"audio,language,speed,text\",\"cmi.core.score.raw\":\"\",\"cmi.student_data.max_time_allowed\":\"\",\"cmi._version\":\"3.4\",\"cmi.comments\":\"\",\"cmi.student_preference.text\":\"0\",\"cmi.launch_data\":\"scormdriver/indexAPI.html\",\"cmi.interactions._count\":\"0\",\"cmi.evaluation.comments._count\":\"0\",\"cmi.core.lesson_mode\":\"normal\",\"cmi.core.exit\":\"suspend\",\"cmi.student_preference.speed\":\"0\",\"cmi.student_preference.audio\":\"0\",\"cmi.core.score._children\":\"raw,min,max\",\"nav.event\":\"\",\"cmi.core.lesson_status\":\"incomplete\",\"cmi.student_data._children\":\"mastery_score,max_time_allowed,time_limit_action\",\"cmi.core.student_id\":\"Anthony Chung\"}},\"scoid\":16,\"attempt\":1,\"offline\":false,\"type\":\"app:fromWebView:scorm\",\"name\":\"save_tracks\",\"cancelBubble\":true}\r\n\r\n\r\n{\"tracks\":[{\"element\":\"cmi.core.total_time\",\"value\":\"00:02:27.86\"}],\"userdata\":{\"16\":{\"cmi.student_preference.language\":\"\",\"cmi.core._children\":\"student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,lesson_mode,exit,session_time\",\"cmi.core.entry\":\"resume\",\"cmi.objectives._children\":\"id,score,status\",\"cmi.core.total_time\":\"00:02:13.25\",\"cmi.core.student_name\":\"Anthony Chung\",\"cmi.core.score.min\":\"\",\"cmi.student_data.mastery_score\":\"\",\"cmi.student_data.time_limit_action\":\"\",\"cmi.core.credit\":\"credit\",\"cmi.core.session_time\":\"0000:00:14.61\",\"cmi.core.lesson_location\":\"index.html#/list/0X1CkVUYKNPDve792clZ4TnlYbPj539b/preview\",\"cmi.objectives._count\":\"0\",\"cmi._children\":\"core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions\",\"cmi.core.score.max\":\"\",\"cmi.suspend_data\":\"{\\\"quizItems\\\":{},\\\"progress\\\":{\\\"V9JVXnfqV_wqghlbKAyvLy7RVYheTWyN\\\":[1,2,3,4,5],\\\"iZHn5EIGvP1ygmJ4PBXaLnfau5-LECH_\\\":[2,3,4,6,7],\\\"0X1CkVUYKNPDve792clZ4TnlYbPj539b\\\":[1]}}\",\"cmi.interactions._children\":\"id,objectives,time,type,correct_responses,weighting,student_response,result,latency\",\"cmi.evaluation.comments._children\":\"content,location,time\",\"cmi.student_preference._children\":\"audio,language,speed,text\",\"cmi.core.score.raw\":\"\",\"cmi.student_data.max_time_allowed\":\"\",\"cmi._version\":\"3.4\",\"cmi.comments\":\"\",\"cmi.student_preference.text\":\"0\",\"cmi.launch_data\":\"scormdriver/indexAPI.html\",\"cmi.interactions._count\":\"0\",\"cmi.evaluation.comments._count\":\"0\",\"cmi.core.lesson_mode\":\"normal\",\"cmi.core.exit\":\"suspend\",\"cmi.student_preference.speed\":\"0\",\"cmi.student_preference.audio\":\"0\",\"cmi.core.score._children\":\"raw,min,max\",\"nav.event\":\"\",\"cmi.core.lesson_status\":\"incomplete\",\"cmi.student_data._children\":\"mastery_score,max_time_allowed,time_limit_action\",\"cmi.core.student_id\":\"Anthony Chung\"}},\"scoid\":16,\"attempt\":1,\"offline\":false,\"type\":\"app:fromWebView:scorm\",\"name\":\"save_tracks\",\"cancelBubble\":true}\r\n\r\n", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-26T08:28:52.000+0000", "updated": "2017-09-26T08:28:52.000+0000" }, { "id": "428459", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Okay, one proposal: Can you go to {{~/Library/Application Support/Titanium/mobilesdk/osx/6.2.2.GA/iphone/Classes/TiUtils.m}} and change line 2088 to {{options:NSJSONReadingAllowFragments}} ?\r\n\r\nThe issue might be in the {{cmi.suspend_data}} key, which holds json inside a json. I don't think we tested against that behavior using the new API, but the above option would handle it. I won't do a PR so far because the old value has it's reasons, but at least we'd know what's causing it and what can fix it. Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-26T08:41:03.000+0000", "updated": "2017-09-26T08:43:41.000+0000" }, { "id": "428460", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "hi. unfortunately the error is still occurring even after the change.\r\n\r\n{code:text}\r\n[ERROR] : The application has crashed with an uncaught exception 'NSRangeException'.\r\n[ERROR] : Reason:\r\n[ERROR] : *** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray\r\n[ERROR] : Stack trace:\r\n[ERROR] : 0 CoreFoundation 0x0000000114a78af3 __exceptionPreprocess + 147\r\n[ERROR] : 1 libobjc.A.dylib 0x00000001140e5141 objc_exception_throw + 48\r\n[ERROR] : 2 CoreFoundation 0x0000000114a9027d -[__NSArray0 objectAtIndex:] + 93\r\n[ERROR] : 3 mLearn 0x000000010c89e0c1 -[AppModule fireEvent:] + 97\r\n[ERROR] : 4 mLearn 0x000000010c89e5a1 -[AppModule fireEvent:withObject:] + 113\r\n[ERROR] : 5 mLearn 0x000000010c768611 -[AppProtocolHandler handleAppToTiRequest] + 945\r\n[ERROR] : 6 mLearn 0x000000010c768b8c -[AppProtocolHandler startLoading] + 188\r\n[ERROR] : 7 CFNetwork 0x0000000111c26206 ___ZN16CFURLProtocol_NS28_protocolInterface_startLoadEPK20_CFCachedURLResponse_block_invoke + 303\r\n[ERROR] : 8 libdispatch.dylib 0x00000001160d4792 _dispatch_client_callout + 8\r\n[ERROR] : 9 libdispatch.dylib 0x00000001160b728d _dispatch_block_invoke_direct + 358\r\n[ERROR] : 10 CFNetwork 0x0000000111b94f88 _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 24\r\n[ERROR] : 11 CoreFoundation 0x00000001149cbbe4 CFArrayApplyFunction + 68\r\n[ERROR] : 12 CFNetwork 0x0000000111b94e5e _ZN19RunloopBlockContext7performEv + 132\r\n[ERROR] : 13 CFNetwork 0x0000000111b94cf8 _ZN17MultiplexerSource7performEv + 282\r\n[ERROR] : 14 CFNetwork 0x0000000111b94b2b _ZN17MultiplexerSource8_performEPv + 65\r\n[ERROR] : 15 CoreFoundation 0x0000000114a1ec01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17\r\n[ERROR] : 16 CoreFoundation 0x0000000114a040cf __CFRunLoopDoSources0 + 527\r\n[ERROR] : 17 CoreFoundation 0x0000000114a035ff __CFRunLoopRun + 911\r\n[ERROR] : 18 CoreFoundation 0x0000000114a03016 CFRunLoopRunSpecific + 406\r\n[ERROR] : 19 CFNetwork 0x0000000111dabf6a _ZL27_privateRunloopEmulationSetPv + 250\r\n[ERROR] : 20 libsystem_pthread.dylib 0x000000011646293b _pthread_body + 180\r\n[ERROR] : 21 libsystem_pthread.dylib 0x0000000116462887 _pthread_body + 0\r\n[ERROR] : 22 libsystem_pthread.dylib 0x000000011646208d thread_start + 13\r\n-- End simulator log ---------------------------------------------------------\r\n{code}\r\n", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-26T08:57:32.000+0000", "updated": "2017-09-26T08:57:32.000+0000" }, { "id": "428461", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, then I definitely need a test-project to reproduce this.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-26T08:59:01.000+0000", "updated": "2017-09-26T08:59:01.000+0000" }, { "id": "428464", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "ok. i'll work on one. thanks for having a go.", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-26T09:16:50.000+0000", "updated": "2017-09-26T09:16:50.000+0000" }, { "id": "428465", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "I've been working on a reproducible test case but am having trouble making it make the crash.\r\nFinding it hard to reproduce.", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-26T10:51:31.000+0000", "updated": "2017-09-26T10:51:31.000+0000" }, { "id": "428466", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Are you able to share your project in private? Feel free to send it to hknoechel@axway.com, thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-26T11:15:35.000+0000", "updated": "2017-09-26T11:15:35.000+0000" }, { "id": "428499", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "Hi. Thanks for offer. Sorry, I can't share the raw project. Your work so far helps me understand more about the TiUtils parser, thank you. I will see if I have more success reproducing a test case. \r\n\r\nIt seems like as you suggested, when the json object has more complex depth and child objects, then the default parser will have more trouble. I think I might have to stringify the sub payload before it sends to be safe, and then unpack after it receives. Thanks for your help so far.\r\n\r\n", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-27T00:06:38.000+0000", "updated": "2017-09-27T00:06:38.000+0000" }, { "id": "428501", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "New angle. I encoded the params with javascript encode_utf8 function below and then it stopped crashing.\r\n\r\nfunction encode_utf8(s) {\r\n return unescape(encodeURIComponent(s));\r\n}\r\n\r\ntiutils.m uses \"value dataUsingEncoding: NSUTF8StringEncoding\"\r\n\r\n+(id)jsonParse:(NSString*)value error:(NSError**)error;\r\n{\r\n return [NSJSONSerialization JSONObjectWithData: [value dataUsingEncoding: NSUTF8StringEncoding]\r\n options: NSJSONReadingMutableContainers\r\n error: error];\r\n}", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-27T01:09:01.000+0000", "updated": "2017-09-27T01:09:01.000+0000" }, { "id": "428503", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "However, I may have made an error, since i encoded the object, rather than a string. so could be a false positive. The utf-8 angle is one that I hadn't thought of.", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-27T01:25:41.000+0000", "updated": "2017-09-27T01:25:41.000+0000" }, { "id": "428510", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Alright. If you could provide the above requested (JSON-payload *and* error - which included the line number of the payload where it was malformed), it would definitely help. Are you already sure it's the sub-json that's causing the issue? Because I've created a test-case where I've put the ones you sent here into a JSON-file, read that, parsed it and provided it as a payload and it worked. Or are you trying to send the JSON-string as a payload? Unless we can find anything to reproduce, this issue would need to be resolved as \"Cannot Reproduce\" which I really want to prevent.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-27T07:36:16.000+0000", "updated": "2017-09-27T07:36:16.000+0000" }, { "id": "428511", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "I've just created a reproducible test case. Am finding a place to upload test to.", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-27T08:49:39.000+0000", "updated": "2017-09-27T08:49:39.000+0000" }, { "id": "428514", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "Hi Hans,\r\n\r\nHere is the test case.\r\n\r\nhttps://github.com/anthonychung/jira-test-case-25346\r\n\r\nReadme has notes.\r\nLook in assets for script.jslocal to see what fires the event.\r\n\r\nCheers,\r\nAnthony", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-27T08:59:39.000+0000", "updated": "2017-09-27T08:59:39.000+0000" }, { "id": "428543", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Update here: I received a test-case form [~kbrand] that reproduces the issue (thanks again):\r\n{code:js}\r\nvar webViewHtml = '\t\t\t\t\t';\r\nvar webview = Titanium.UI.createWebView({html: webViewHtml});\r\nvar window = Titanium.UI.createWindow();\r\nwindow.add(webview);\r\nwindow.open();\r\n\r\nTi.App.addEventListener('testEvent', function(json) {\r\n\talert('Event catched');\r\n});\r\n{code}\r\nThe issue is definitely the json-payload inside the json itself, which is not properly serialized. After giving it a quick shot today, I was not unable to fix it so far and the native world does not offer an API to fix corrupt JSON except the old library we used (to serialize fragments). Although I already told Kristjan that it might be resolved as {{Won't fix}}, I will give it another shot tomorrow to scope the required change to fix it internally. Updating here again as soon as I have more.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-09-27T22:02:06.000+0000", "updated": "2017-09-27T22:02:06.000+0000" }, { "id": "428546", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "Hi [~hknoechel],\r\n\r\nJust checking if you saw the different test case that is different to Kristjan’s one.\r\n\r\nhttps://github.com/anthonychung/jira-test-case-25346\r\n\r\nIt uses a different payload, and works in 6.1.1, but not in 6.2.2.\r\n\r\nI was also wondering if it is actually utf-8 related, and had questions about how .jslocal might be related to this issue?\r\n\r\nThanks,\r\nAnthony\r\n", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-09-27T22:24:43.000+0000", "updated": "2017-09-27T22:25:50.000+0000" }, { "id": "428634", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/9498\r\nPR (6_3_X): https://github.com/appcelerator/titanium_mobile/pull/9499\r\n\r\nTest-Case (crashes on 6.2.x, won't crash on 6.3.x and 7.0.0):\r\n{code:js}\r\nvar webViewHtml = '\t\t\t\t\t';\r\nvar webview = Titanium.UI.createWebView({html: webViewHtml});\r\nvar window = Titanium.UI.createWindow();\r\nwindow.add(webview);\r\nwindow.open();\r\n \r\nTi.App.addEventListener('testEvent', function(json) {\r\n\tTi.API.info(json);\r\n});\r\n{code}\r\n\r\nA side-note regarding the root-cause: The JSON-library we used before does the decoding of the event for us, which is currently not possible with the built-in iOS-API. This PR restores the old usage for this special use-case. Also to be considered for a 6.2.3.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-10-02T12:16:32.000+0000", "updated": "2017-10-02T12:16:32.000+0000" }, { "id": "428907", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "FR Passed. Able to use nested JSON payload in fireEvent without issue. Tested using provided code as well as the webview and app suites.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-10-10T20:09:48.000+0000", "updated": "2017-10-10T20:10:10.000+0000" }, { "id": "429503", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~threethirds] Have you had the chance to check the 6.3.0 RC to confirm the fix?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-10-24T16:04:02.000+0000", "updated": "2017-10-24T16:04:02.000+0000" }, { "id": "429646", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "Hi [~hknoechel]\r\n\r\nI tried to run it using the latest .\r\n 6.3.0.v20171018084007\r\nBut when I close this window, it has the following crash.\r\nI don't think the crash is related to this issue though. It seems something to do with with 6.3.0.\r\nUnfortunately I can't confirm your question because of this new crash log.\r\n\r\nHave you seen the following crash log.\r\nThanks,\r\nAnthony\r\n\r\n{code:text}\r\n\r\n[INFO] : scorm:closeindexwindow called\r\n[ERROR] : The application has crashed with an uncaught exception 'NSInvalidArgumentException'.\r\n[ERROR] : Reason:\r\n[ERROR] : -[TiUIWindowProxy setLargeTitleEnabled:]: unrecognized selector sent to instance 0x7f82c7120a00\r\n[ERROR] : Stack trace:\r\n[ERROR] : 0 CoreFoundation 0x0000000116ae6af3 __exceptionPreprocess + 147\r\n[ERROR] : 1 libobjc.A.dylib 0x00000001160a4141 objc_exception_throw + 48\r\n[ERROR] : 2 CoreFoundation 0x0000000116b56134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132\r\n[ERROR] : 3 CoreFoundation 0x0000000116a6d840 ___forwarding___ + 1024\r\n[ERROR] : 4 CoreFoundation 0x0000000116a6d3b8 _CF_forwarding_prep_0 + 120\r\n[ERROR] : 5 mLearn 0x000000010e9ce198 -[TiUIWindowProxy setupWindowDecorations] + 1032\r\n[ERROR] : 6 mLearn 0x000000010e9c6df1 -[TiUIWindowProxy viewWillAppear:] + 65\r\n[ERROR] : 7 mLearn 0x000000010e981f1e -[TiViewController viewWillAppear:] + 158\r\n[ERROR] : 8 UIKit 0x000000010f48bbad -[UIViewController _setViewAppearState:isAnimating:] + 447\r\n[ERROR] : 9 UIKit 0x000000010f48c3c3 -[UIViewController __viewWillAppear:] + 147\r\n[ERROR] : 10 UIKit 0x000000010f4b63c8 -[UINavigationController _startCustomTransition:] + 1305\r\n[ERROR] : 11 UIKit 0x000000010f4c6967 -[UINavigationController _startDeferredTransitionIfNeeded:] + 687\r\n[ERROR] : 12 UIKit 0x000000010f4c7b41 -[UINavigationController __viewWillLayoutSubviews] + 58\r\n[ERROR] : 13 UIKit 0x000000010f6b960c -[UILayoutContainerView layoutSubviews] + 231\r\n[ERROR] : 14 UIKit 0x000000010f3a655b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268\r\n[ERROR] : 15 QuartzCore 0x0000000114d59904 -[CALayer layoutSublayers] + 146\r\n[ERROR] : 16 QuartzCore 0x0000000114d4d526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370\r\n[ERROR] : 17 QuartzCore 0x0000000114d4d3a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24\r\n[ERROR] : 18 QuartzCore 0x0000000114cdce92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294\r\n[ERROR] : 19 QuartzCore 0x0000000114d09130 _ZN2CA11Transaction6commitEv + 468\r\n[ERROR] : 20 QuartzCore 0x0000000114d09b37 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 115\r\n[ERROR] : 21 CoreFoundation 0x0000000116a8c717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23\r\n[ERROR] : 22 CoreFoundation 0x0000000116a8c687 __CFRunLoopDoObservers + 391\r\n[ERROR] : 23 CoreFoundation 0x0000000116a71720 __CFRunLoopRun + 1200\r\n[ERROR] : 24 CoreFoundation 0x0000000116a71016 CFRunLoopRunSpecific + 406\r\n[ERROR] : 25 GraphicsServices 0x000000011a32ea24 GSEventRunModal + 62\r\n[ERROR] : 26 UIKit 0x000000010f2e3134 UIApplicationMain + 159\r\n[ERROR] : 27 mLearn 0x000000010e972144 main + 100\r\n[ERROR] : 28 libdyld.dylib 0x00000001182cd65d start + 1\r\n-- End simulator log ---------------------------------------------------------\r\n{code}\r\n", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-10-26T05:37:06.000+0000", "updated": "2017-10-26T05:37:06.000+0000" }, { "id": "429647", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "This issue is likely caused by an incompatibility with the xcode that I need to run. Xcode8-3-3.app", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-10-26T06:08:43.000+0000", "updated": "2017-10-26T06:08:43.000+0000" }, { "id": "429649", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "[~hknoechel] This issue is confirmed to be fixed.\r\n\r\nThe other crash is caused by not running the latest version of xcode.", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-10-26T06:14:28.000+0000", "updated": "2017-10-26T06:14:28.000+0000" }, { "id": "429650", "author": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "body": "Thanks [~hknoechel] for reverting to json parser with no crash for nested object!", "updateAuthor": { "name": "threethirds", "key": "threethirds", "displayName": "Anthony Chung", "active": true, "timeZone": "Australia/Sydney" }, "created": "2017-10-26T06:37:05.000+0000", "updated": "2017-10-26T06:37:05.000+0000" }, { "id": "429655", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "And the other one is fixed for the 6.3.0.GA as well (open PR), thanks! I am wondering because we received another report about this not being fixed, so I'll ensure to test against that as well.\r\n\r\n*EDIT*: Simple reproducible case:\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function(e) {\r\n openWindow()\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n\r\nTi.App.addEventListener('test', function(e) {\r\n Ti.API.info(e);\r\n});\r\n\r\nfunction openWindow() {\r\n var win2 = Ti.UI.createWindow({\r\n backgroundColor: 'red'\r\n });\r\n\r\n var btn2 = Ti.UI.createButton({\r\n title: 'Close'\r\n });\r\n\r\n btn2.addEventListener('click', function(e) {\r\n Ti.App.fireEvent(\"test\", {btn: Ti.UI.createButton({title: 'Test'})});\r\n win2.close();\r\n });\r\n\r\n win2.add(btn2);\r\n win2.open();\r\n}\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-10-26T07:50:06.000+0000", "updated": "2017-10-26T07:57:48.000+0000" }, { "id": "429656", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): Awaiting https://github.com/appcelerator/titanium_mobile/pull/9498 to be merged before\r\nPR (6_3_X): https://github.com/appcelerator/titanium_mobile/pull/9555\r\n\r\nFor QE: See test-case above. The code-change simply reverts a previous change which is okay because the old one was just a API-replacement.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-10-26T08:15:03.000+0000", "updated": "2017-10-26T08:15:03.000+0000" }, { "id": "429859", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR's merged. changes are seen in the following builds:\r\n6.3.0.v20171030133255\r\n7.0.0.v20171030085253", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-10-30T21:45:37.000+0000", "updated": "2017-10-30T21:45:37.000+0000" } ], "maxResults": 29, "total": 29, "startAt": 0 } } }