{ "id": "92281", "key": "TIMOB-9222", "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": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13407", "description": "Sprint 2012-11 API", "name": "Sprint 2012-11 API", "archived": true, "released": true, "releaseDate": "2012-06-03" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-06-02T22:26:55.000+0000", "created": "2012-05-24T07:54:18.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "module_clipboard", "qe-testadded" ], "versions": [ { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" } ], "issuelinks": [], "assignee": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-06T19:03:36.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": "h2. Problem\r\n\r\nThe hasData and getData methods of [Titanium.UI.Clipboard|http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.Clipboard] fail and cause exceptions. See the test case below, and the source at [TiUIClipboardProxy.m|https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIClipboardProxy.m].\r\n\r\nh2. Test case\r\n\r\n{code:lang=javascript|title=app.js}\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\nTi.API.log('Deleting all text in Clipboard');\r\nTi.UI.Clipboard.clearText();\r\nTi.API.log('Clipboard.getText(): ' + Ti.UI.Clipboard.getText()); // returns undefined when empty\r\nTi.API.log('Set text Clipboard to hello');\r\nTi.UI.Clipboard.setText('hello');\r\nTi.API.log('Clipboard.hasText(), should be true: ' + Ti.UI.Clipboard.hasText()); // hasText() returns 0 or 1 instead of boolean\r\nTi.API.log('Clipboard.getText(), should be hello: ' + Ti.UI.Clipboard.getText());\r\n\r\n\r\nif (Ti.UI.iOS){\r\n\tTi.API.log('Deleting all data in Clipboard');\r\n\tTi.UI.Clipboard.clearData();\r\n\tTi.API.log('Adding 3 URLs to Clipboard');\r\n\tTi.UI.Clipboard.setData('text/uri-list', 'http://www.appcelerator.com/');\r\n\tTi.UI.Clipboard.setData('text/uri-list', 'http://developer.android.com/');\r\n\tTi.UI.Clipboard.setData('text/uri-list', 'https://developer.apple.com/');\r\n\tTi.API.log('Getting URLs from Clipboard');\r\n\tTi.API.log('Does Clipboard contain data of type text/uri-list?): ' + Ti.UI.Clipboard.hasData('text/uri-list')); // causes exception\r\n\tTi.UI.Clipboard.getData('text/uri-list'); // causes exception\r\n\t\r\n\tTi.API.log('Does Clipboard contain data of type image?): ' + Ti.UI.Clipboard.hasData('image')); // causes exception\r\n\tTi.UI.Clipboard.getData('image'); // causes exception\r\n}\r\n{code}\r\n\r\nh2. Logs\r\n\r\n{code:lang=none|title=console}\r\n[ERROR] Invalid type passed to function. expected: NSString, was: __NSArrayM in -TiUIClipboardProxy getData:\r\n\r\n[ERROR] Script Error = Invalid type passed to function. expected: NSString, was: __NSArrayM in -TiUIClipboardProxy getData: at app.js (line 3307).\r\n{code}\r\n\r\nh2. Discussions\r\n\r\nThere are no reports in the Q&A that suggest that anyone has successfully used these methods. If it does function as expected, we will need to document this accordingly with some examples.", "attachment": [], "flagged": false, "summary": "iOS: UI.Clipboard hasData and getData cause exceptions", "creator": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "environment": "* Titanium 2.0.1 GA2\r\n* iOS 5.0\r\n* Simulator\r\n", "comment": { "comments": [ { "id": "196210", "author": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Addressed in PR:\r\nhttps://github.com/appcelerator/titanium_mobile/pull/2283", "updateAuthor": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-27T14:21:42.000+0000", "updated": "2012-05-27T14:21:42.000+0000" }, { "id": "196355", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR merged https://github.com/appcelerator/titanium_mobile/pull/2283", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-29T14:11:58.000+0000", "updated": "2012-05-29T14:11:58.000+0000" }, { "id": "196405", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "APIDOC fixed in https://github.com/appcelerator/titanium_mobile/pull/2269", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-05-29T18:06:59.000+0000", "updated": "2012-05-29T18:06:59.000+0000" }, { "id": "197296", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing bug. Verified fix on:\r\n\r\nSDK build: 2.1.0.v20120604151821\r\nTitanium Studio, build: 2.0.2.201205311912\r\nxcode: 4.3.2\r\nDevice: iphone simulator (5.0), iphone 4s verizon (5.0.1)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-06-05T10:29:10.000+0000", "updated": "2012-06-05T10:29:10.000+0000" }, { "id": "278472", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4731\n", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-06T19:03:36.000+0000", "updated": "2013-11-06T19:03:36.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }