{ "id": "168930", "key": "AC-5081", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2017-07-19T18:50:56.000+0000", "created": "2017-07-12T17:51:54.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-07-19T18:50:56.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Titanium SDK 6.1.0 GA – the below code works successfully\r\nTitanium SDK 6.1.1 GA – Error \r\n\r\n{code}\r\n[ERROR] : message = \"Invalid type passed to function\";\r\n[ERROR] : nativeLocation = \"-[TiProxy addEventListener:] (TiProxy.m:838)\";\r\n[ERROR] : nativeReason = \"expected: Function, was: String\";\r\n{code}\r\n\r\n\r\nHelp to fix the bug and correct me if I did something wrong.\r\n\r\n{code:javascript}\r\n var avatar = {\r\n\t RemoteImage: function(a) {\r\n\t\t\ta = a || {};\r\n\r\n\t\t\tvar md5;\r\n\t\t\tvar needsToSave = false;\r\n\t\t\tvar savedFile;\r\n\r\n\t\t\tif (a.image) {\r\n\t\t\t\tmd5 = Ti.Utils.md5HexDigest(a.image) + '.png';\r\n\t\t\t\tsavedFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, md5);\r\n\r\n\t\t\t\tif (savedFile.exists()) {\r\n\t\t\t\t\ta.image = savedFile;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tneedsToSave = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (needsToSave == true) {\r\n\t\t\t\tvar image = Ti.UI.createImageView(a);\r\n\r\n\t\t\t\tfunction saveImage(e) {\r\n\t\t\t\t\timage.removeEventListener('load', saveImage);\r\n\t\t\t\t\tsavedFile.write(\r\n\t\t\t\t\t\timage.toImage(null, true)\r\n\t\t\t\t\t);\r\n\t\t\t\t};\r\n\r\n\t\t\t\timage.addEventListener('load', saveImage);\r\n\r\n\t\t\t\tfunction defaultAvatar(e) {\r\n\t\t\t\t\timage.setImage(a.data_user_avatar_default);\r\n\t\t\t\t\timage.removeEventListener('error', defaultAvatar);\r\n\t\t\t\t};\r\n\r\n\t\t\t\timage.addEventListener('error', defaultAvatar);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tvar image = Ti.UI.createImageView(a);\r\n\t\t\t}\r\n\r\n\t\t\treturn image;\r\n\t\t}\r\n\t};\r\n\r\n var profileAvatar = avatar.RemoteImage({\r\n\t\timage: 'https://www.gravatar.com/avatar/image.png',\r\n\t data_user_avatar_default: 'https://www.gravatar.com/avatar/md5.png',\r\n\t\tdefaultImage: '/img/avatar_preload.png',\r\n\t\twidth: 60,\r\n\t\theight: 60\r\n\t});\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: 6.1.1 GA / removeEventListener under addEventListener without error?", "creator": { "name": "63ek", "key": "63ek", "displayName": "Maxim Khrichtchatyi", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "63ek", "key": "63ek", "displayName": "Maxim Khrichtchatyi", "active": true, "timeZone": "Asia/Dhaka" }, "environment": null, "comment": { "comments": [ { "id": "424167", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, please share a full reproducible test code. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-07-14T19:44:09.000+0000", "updated": "2017-07-14T19:44:09.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }