{ "id": "162958", "key": "TIMOB-23858", "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": "18253", "name": "Release 5.5.0", "archived": false, "released": true, "releaseDate": "2016-09-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-09-05T03:38:21.000+0000", "created": "2016-09-01T21:16:03.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "qe-5.5.0" ], "versions": [ { "id": "18253", "name": "Release 5.5.0", "archived": false, "released": true, "releaseDate": "2016-09-13" } ], "issuelinks": [ { "id": "52598", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "162720", "key": "TIMOB-23797", "fields": { "summary": "iOS: Improve Pasteboard support", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-09-06T21:47:20.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": "The getItems() method is throwing an error after data has been cleared or items in the Pasteboard are invalid:\r\n{code}\r\n[ERROR] : 2016-09-01 06:35:19.000 PasteboardCheck[12358:22821338] -[_NSZeroData boundBridge:withKrollObject:]: unrecognized selector sent to instance 0x79e63d80\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 39;\r\n[ERROR] : line = 58;\r\n[ERROR] : message = \"-[_NSZeroData boundBridge:withKrollObject:]: unrecognized selector sent to instance 0x79e63d80\";\r\n[ERROR] : stack = \"[native code]\\n\";\r\n[ERROR] : }\r\n{code}\r\n\r\n*Steps to reproduce issue*\r\n1. Create a new project\r\n2. Add the below lines to the code, preferably on a button press:\r\n{code:javascript}\r\nTi.UI.Clipboard.clearData();\r\nalert(Ti.UI.Clipboard.getItems());\r\n{code}\r\n3. Run the project and press the button or call the methods\r\n\r\n*Expected results*\r\n{{getItems()}} returns an empty array, without error\r\n\r\n*Actual results*\r\nThe above error is thrown\r\n\r\n*Notes*\r\nThis is stated in the docs for setItems(), but is there a way we can handle it better? Perhaps checking numberOfItems and using that to make sure the Pasteboard is not empty first?\r\nAlthough a runtime error is thrown, you can see an empty array returned from getItems() if you dismiss the error and call it again. However, If you clear the data with clearData() and then call getItems() too many times (sometimes 2), then the app will crash with the below error:\r\n{code}\r\n[ERROR] : The application has crashed with an uncaught exception 'NSInvalidArgumentException'.\r\n[ERROR] : Reason:\r\n[ERROR] : -[_NSZeroData unboundBridge:]: unrecognized selector sent to instance 0x79191700\r\n[ERROR] : Stack trace:\r\n[ERROR] : \r\n[ERROR] : 0 CoreFoundation 0x06f851f0 __exceptionPreprocess + 160\r\n[ERROR] : 1 libobjc.A.dylib 0x065fae66 objc_exception_throw + 52\r\n[ERROR] : 2 CoreFoundation 0x06ffe3dc -[NSObject(NSObject) doesNotRecognizeSelector:] + 172\r\n[ERROR] : 3 CoreFoundation 0x06f0434c ___forwarding___ + 1052\r\n[ERROR] : 4 CoreFoundation 0x06f03f0e _CF_forwarding_prep_0 + 14\r\n[ERROR] : 5 PasteboardCheck 0x00061d6e -[KrollBridge unregisterProxy:] + 158\r\n[ERROR] : 6 PasteboardCheck 0x00070839 KrollFinalizer + 489\r\n[ERROR] : 7 PasteboardCheck 0x0042c42c _ZN2TI20JSCallbackObjectData8finalizeENS_6HandleINS_7UnknownEEEPv + 108\r\n[ERROR] : 8 PasteboardCheck 0x005fb4ae _ZN2TI9WeakBlock5sweepEv + 110\r\n[ERROR] : 9 PasteboardCheck 0x005fd358 _ZN2TI7WeakSet5sweepEv + 40\r\n[ERROR] : 10 PasteboardCheck 0x004eedbc _ZN2TI11MarkedBlock5sweepENS0_9SweepModeE + 28\r\n[ERROR] : 11 PasteboardCheck 0x003c08fa _ZN2TI18IncrementalSweeper7doSweepEd + 154\r\n[ERROR] : 12 PasteboardCheck 0x003c084b _ZN2TI18IncrementalSweeper6doWorkEv + 27\r\n[ERROR] : 13 PasteboardCheck 0x003bf566 _ZN2TI9HeapTimer12timerDidFireEP16__CFRunLoopTimerPv + 166\r\n[ERROR] : 14 CoreFoundation 0x06f115d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22\r\n[ERROR] : 15 CoreFoundation 0x06f110ed __CFRunLoopDoTimer + 1213\r\n[ERROR] : 16 CoreFoundation 0x06f10bff __CFRunLoopDoTimers + 255\r\n[ERROR] : 17 CoreFoundation 0x06f086c0 __CFRunLoopRun + 2208\r\n[ERROR] : 18 CoreFoundation 0x06f07bab CFRunLoopRunSpecific + 395\r\n[ERROR] : 19 CoreFoundation 0x06f07a0b CFRunLoopRunInMode + 123\r\n[ERROR] : 20 GraphicsServices 0x08241b4c GSEventRunModal + 177\r\n[ERROR] : 21 GraphicsServices 0x082419c7 GSEventRun + 80\r\n[ERROR] : 22 UIKit 0x025480eb UIApplicationMain + 148\r\n[ERROR] : 23 PasteboardCheck 0x000462e8 main + 408\r\n[ERROR] : 24 libdyld.dylib 0x07d96799 start + 1\r\n[ERROR] : 25 ??? 0x00000001 0x0 + 1\r\n[ERROR] : \r\n[ERROR] : 2016-09-01 06:37:27.651 PasteboardCheck[12715:22825481] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSZeroData unboundBridge:]: unrecognized selector sent to instance 0x79191700'\r\n[ERROR] : *** First throw call stack:\r\n[ERROR] : (\r\n[ERROR] : \t0 CoreFoundation 0x06f85212 __exceptionPreprocess + 194\r\n[ERROR] : \t1 libobjc.A.dylib 0x065fae66 objc_exception_throw + 52\r\n[ERROR] : \t2 CoreFoundation 0x06ffe3dc -[NSObject(NSObject) doesNotRecognizeSelector:] + 172\r\n[ERROR] : \t3 CoreFoundation 0x06f0434c ___forwarding___ + 1052\r\n[ERROR] : \t4 CoreFoundation 0x06f03f0e _CF_forwarding_prep_0 + 14\r\n[ERROR] : \t5 PasteboardCheck 0x00061d6e -[KrollBridge unregisterProxy:] + 158\r\n[ERROR] : \t6 PasteboardCheck 0x00070839 KrollFinalizer + 489\r\n[ERROR] : \t7 PasteboardCheck 0x0042c42c _ZN2TI20JSCallbackObjectData8finalizeENS_6HandleINS_7UnknownEEEPv + 108\r\n[ERROR] : \t8 PasteboardCheck 0x005fb4ae _ZN2TI9WeakBlock5sweepEv + 110\r\n[ERROR] : \t9 PasteboardCheck 0x005fd358 _ZN2TI7WeakSet5sweepEv + 40\r\n[ERROR] : \t10 PasteboardCheck 0x004eedbc _ZN2TI11MarkedBlock5sweepENS0_9SweepModeE + 28\r\n[ERROR] : \t11 PasteboardCheck 0x003c08fa _ZN2TI18IncrementalSweeper7doSweepEd + 154\r\n[ERROR] : \t12 PasteboardCheck 0x003c084b _ZN2TI18IncrementalSweeper6doWorkEv + 27\r\n[ERROR] : \t13 PasteboardCheck 0x003bf566 _ZN2TI9HeapTimer12timerDidFireEP16__CFRunLoopTimerPv + 166\r\n[ERROR] : \t14 CoreFoundation 0x06f115d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22\r\n[ERROR] : \t15 CoreFoundation 0x06f110ed __CFRunLoopDoTimer + 1213\r\n[ERROR] : \t16 CoreFoundation 0x06f10bff __CFRunLoopDoTimers + 255\r\n[ERROR] : \t17 CoreFoundation 0x06f086c0 __CFRunLoopRun + 2208\r\n[ERROR] : \t18 CoreFoundation 0x06f07bab CFRunLoopRunSpecific + 395\r\n[ERROR] : \t19 CoreFoundation 0x06f07a0b CFRunLoopRunInMode + 123\r\n[ERROR] : \t20 GraphicsServices 0x08241b4c GSEventRunModal + 177\r\n[ERROR] : \t21 GraphicsServices 0x082419c7 GSEventRun + 80\r\n[ERROR] : \t22 UIKit 0x025480eb UIApplicationMain + 148\r\n[ERROR] : \t23 PasteboardCheck 0x000462e8 main + 408\r\n[ERROR] : \t24 libdyld.dylib 0x07d96799 start + 1\r\n[ERROR] : \t25 ??? 0x00000001 0x0 + 1\r\n[ERROR] : )\r\n[ERROR] : libc++abi.dylib: terminating with uncaught exception of type NSException\r\n[TRACE] : [PasteboardCheck] -[_NSZeroData unboundBridge:]: unrecognized selector sent to instance 0x79191700\r\n[TRACE] : [PasteboardCheck] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSZeroData unboundBridge:]: unrecognized selector sent to instance 0x79191700'\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: getItems() on cleared Pasteboard errors and crashes", "creator": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "MacOS 10.12 (16A239m)\r\nStudio 4.7.1.201608190732\r\nTi SDK 5.5.0.v20160831204306\r\nAppc NPM 4.2.7\r\nAppc CLI 5.5.0-5\r\nAlloy 1.9.1\r\nXcode 8.0 (8S201h)", "closedSprints": [ { "id": 704, "state": "closed", "name": "2016 Sprint 18 SDK", "startDate": "2016-08-27T00:18:36.960Z", "endDate": "2016-09-10T00:18:00.000Z", "completeDate": "2016-09-09T20:26:13.865Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "395286", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/8313\r\nPR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8312\r\nPR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8311\r\n\r\nTest-case 1: Set invalid items, clear data, get items again:\r\n{code:javascript}\r\nTi.UI.Clipboard.setItems({\r\n items: [{\r\n \"__text__invalid/plain\": \"Appcelerator\"\r\n }]\r\n});\r\nTi.UI.Clipboard.clearData();\r\nalert(Ti.UI.Clipboard.getItems());\r\n{code}\r\nExpected: Empty array, no crash\r\n\r\nTest-case 2: Set invalid items, don't clear data, get items again: \r\n{code:javascript}\r\nTi.UI.Clipboard.setItems({\r\n items: [{\r\n \"__text__invalid\": \"Appcelerator\"\r\n }]\r\n});\r\nalert(Ti.UI.Clipboard.getItems());\r\n{code}\r\nExpected: Error-log about invalid mime-type, empty array, no crash", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-09-04T15:55:33.000+0000", "updated": "2016-09-05T03:29:12.000+0000" }, { "id": "395287", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cng] This will be the last ticket you will see for the Pasteboard-API's. Sorry for the inconvenience caused!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-04T15:57:52.000+0000", "updated": "2016-09-04T15:57:52.000+0000" }, { "id": "395304", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR and FT passed. APPROVED! \r\nPRs merged.\r\n", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-09-05T03:38:03.000+0000", "updated": "2016-09-05T03:38:03.000+0000" }, { "id": "395442", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.12 (16A239m)\r\nStudio 4.7.1.201608190732\r\nTi SDK 5.5.0.v20160904203801\r\nAppc NPM 4.2.7\r\nAppc CLI 5.5.0-5\r\nAlloy 1.9.1\r\nXcode 8.0 (8S201h)\r\n\r\n{{getItems}} no longer throws an error. Tested using the provided examples as well as reusing the examples that I used when discovering the issue. {{getItems}} was called when the Pasteboard was in multiple different states and it did not throw any errors.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-09-06T21:47:20.000+0000", "updated": "2016-09-06T21:47:20.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }