{ "id": "155569", "key": "TIMOB-20535", "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": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-03-09T22:20:28.000+0000", "created": "2016-03-09T03:27:29.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios", "qe-5.4.0", "watchOS2", "watchkit" ], "versions": [ { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-08-05T22:13: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": "Just now noticing this in the Ti SDK around the watch sendMessage method. Anytime I try to fire the method I get:\r\n\r\n{code}\r\n[ERROR] Script Error {\r\n[ERROR] column = 48;\r\n[ERROR] line = 517;\r\n[ERROR] message = \"-[WCSession sendMessage:replyHandler:errorHandler:]: message cannot be nil.\";\r\n[ERROR] sourceURL = \"file:///Users/rickblalock/Library/Developer/CoreSimulator/Devices/DD7C8848-C744-4ECD-ADC1-B7A641519F10/data/Containers/Bundle/Application/A7670C9E-9548-4945-8726-E6FB156135B1/Fish%20Rules%20App.app/core.js\";\r\n[ERROR] stack = \"[native code]\\nreceiveWatchMessage@file:///Users/rickblalock/Library/Developer/CoreSimulator/Devices/DD7C8848-C744-4ECD-ADC1-B7A641519F10/data/Containers/Bundle/Application/A7670C9E-9548-4945-8726-E6FB156135B1/Fish%20Rules%20App.app/core.js:517:48\";\r\n[ERROR] }\r\n{code}\r\n\r\nSample snippet of code:\r\n\r\nTi: \r\n{code}\r\nTi.WatchSession.sendMessage({\r\n favorites: ['some value']\r\n});\r\n{code}\r\n\r\nSwift (request from the watch to app):\r\n{code}\r\n\t\t\tself.session.sendMessage(\r\n\t\t\t\t[\"type\": \"favorites\"],\r\n\t\t\t\treplyHandler: nil,\r\n\t\t\t\terrorHandler: nil\r\n\t\t\t)\r\n{code}\r\n\r\nSwift (receiving info from the app to watch):\r\n{code}\r\n\tfunc session(session: WCSession, didReceiveMessage message: [String : AnyObject]) {\r\n\t\tif (message[\"favorites\"] != nil) {\r\n\t\t\tself.favorites = message[\"favorites\"]! as? Array\r\n\t\t\treturn;\r\n\t\t}\r\n// ... etc\r\n{code}\r\n\r\nAccording to the run time error, it's being caused from the Titanium API `sendMessage`", "attachment": [], "flagged": false, "summary": "iOS: Ti.WatchSession.sendMessage \"message cannot be nil\"", "creator": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "environment": null, "comment": { "comments": [ { "id": "379284", "author": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "body": "Ok I figured it out. Back in Sept. the functionality changed. So this is a regression from how it worked before.\r\n\r\nPer https://github.com/appcelerator/titanium_mobile/blob/0dce6d55b7d3b29cec31e19da6544177f27e1437/iphone/Classes/WatchSessionModule.m#L159 - this works:\r\n\r\n{code}\r\n\t\t\t\t\tTi.WatchSession.sendMessage({\r\n\t\t\t\t\t\tmessage: {\r\n\t\t\t\t\t\t\tfavorites: arr\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n{code}", "updateAuthor": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "created": "2016-03-09T03:35:59.000+0000", "updated": "2016-03-09T03:35:59.000+0000" }, { "id": "379285", "author": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "body": "Looking at https://github.com/appcelerator/titanium_mobile/commit/1d8aee1d2e4862d3d81271aff8ad836b2b09260a#diff-c8e5ac73085caff0252e3086f1c970e3 - it looks like maybe the docs just need to be updated to point this out eh? This looks intentional, not so much an accidental regression", "updateAuthor": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "created": "2016-03-09T03:37:16.000+0000", "updated": "2016-03-09T03:37:16.000+0000" }, { "id": "379286", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~hansknoechel] take a look? should be a docs issue.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-03-09T03:40:00.000+0000", "updated": "2016-03-09T03:40:00.000+0000" }, { "id": "379322", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~rblalock] Looking through the [docs|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.WatchSession-method-sendMessage], the {{message}} property is available. We could add the {{required}} flag and a note, that the property is required.\r\n\r\n-In addition to that, it looks like our API expects the callback as {{onReply}}, but the docs say {{reply}}. I'd actually prefer the {{reply}} naming, since it's the same with {{success}}, {{error}}, {{cancel}} callback's in other API's (so without the alloy-style {{on}}). What do you guys think? Could deprecate it for 5.4.0 and we clean-up in 6.0.0.- \r\n\r\nEDIT: Looks like already been changed, great!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-03-09T11:38:53.000+0000", "updated": "2016-03-09T14:28:08.000+0000" }, { "id": "379324", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "We should also update the sample app [here|https://github.com/appcelerator-developer-relations/appc-sample-watchos2/blob/master/app/controllers/watchsession.js].", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-03-09T11:40:35.000+0000", "updated": "2016-03-09T11:40:35.000+0000" }, { "id": "379340", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/7819", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-03-09T14:37:11.000+0000", "updated": "2016-03-09T14:37:11.000+0000" }, { "id": "392557", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, \r\n\r\nTested On:\r\niPhone 6S (9.3.3) Device\r\nWatch OS 2.2.2\r\nMac OSX El Capitan 10.11.6\r\nTi SDK: 5.4.0.v20160804185318\r\nAppc Studio: 4.7.0.201607250649\r\nAppc NPM: 4.2.7\t\r\nApp CLI: 5.4.0-37\r\nXcode 7.3.1\r\nNode v4.4.7\r\n\r\n*Closing ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-08-05T22:13:40.000+0000", "updated": "2016-08-05T22:13:40.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }