{ "id": "152711", "key": "TIMOB-19889", "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": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2015-11-23T02:49:15.000+0000", "created": "2015-11-06T21:40:39.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios" ], "versions": [ { "id": "16778", "description": "Release 5.0.1", "name": "Release 5.0.1", "archived": false, "released": true, "releaseDate": "2015-09-25" }, { "id": "16904", "description": "Release 5.0.2", "name": "Release 5.0.2", "archived": true, "released": true, "releaseDate": "2015-10-01" }, { "id": "16925", "description": "WatchKit Support--all going into 5.0 now", "name": "Release 5.0.0", "archived": true, "released": true, "releaseDate": "2015-09-16" } ], "issuelinks": [ { "id": "49865", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "150555", "key": "TIMOB-19386", "fields": { "summary": "iOS9: Upgrade coremotion module to support bitcode, rewrite code base", "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": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-01-19T19:19:13.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": "h6. Issue Description\r\n\r\nCore motion is crashing using iOS 9.1 on device when the user start to move or walk \r\n\r\nh6.Steps to reproduce \r\n1- create a sample app alloy project\r\n2. paste the next code: \r\n\r\napp/views/index.xml\r\n{code}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\napp/styles/index.tss\r\n{code}\r\n\"ProgressBar\" : {\r\n \"top\" : 10,\r\n \"width\" : 200,\r\n \"min\" : 0,\r\n \"max\" : 3.1415927\r\n},\r\n\"Label\" : {\r\n \"font\" : {\r\n textStyle: Ti.UI.TEXT_STYLE_SUBHEADLINE\r\n },\r\n \"top\" : 50,\r\n \"left\" : 10\r\n} \r\n{code}\r\n\r\napp/controllers/index.js\r\n{code}\r\nvar accelX = accelY = accelZ = 0;\r\nvar lastX = lastY = lastZ = 0;\r\nvar ACCEL_THRESHOLD = 2;\r\nvar SHAKE_THRESHOLD = 5;\r\nvar CoreMotion = require('ti.coremotion');\r\nif (CoreMotion.isDeviceMotionAvailable()) {\r\n CoreMotion.setDeviceMotionUpdateInterval(500);\r\n var frames = CoreMotion.availableAttitudeReferenceFrames();\r\n var ref_frame = CoreMotion.ATTITUDE_REFERENCE_FRAME_X_TRUE_NORTH_Z_VERTICAL;\r\n if (frames & ref_frame) {\r\n // Use the True North Frame if available\r\n Ti.API.debug('REFERENCE FRAME: True North');\r\n CoreMotion.startDeviceMotionUpdatesUsingReferenceFrame(\r\n {referenceFrame: ref_frame},\r\n updateMotionData \r\n );\r\n }\r\n else if (ref_frame = CoreMotion.getAttitudeReferenceFrame()) {\r\n // Use the default frame if it exists\r\n Ti.API.debug('REFERENCE FRAME: Default ' + ref_frame);\r\n CoreMotion.startDeviceMotionUpdatesUsingReferenceFrame(\r\n {referenceFrame: ref_frame},\r\n updateMotionData \r\n ); \r\n } else {\r\n // Do not use a reference frame\r\n Ti.API.debug('REFERENCE FRAME: None');\r\n CoreMotion.startDeviceMotionUpdates(updateMotionData);\r\n }\r\n}\r\nfunction updateMotionData (e) {\r\n \r\n if (e.success) { \r\n var data = e.userAcceleration;\r\n if (Math.abs(lastX - data.x) > ACCEL_THRESHOLD) {\r\n accelX++;\r\n }\r\n if (Math.abs(lastY - data.y) > ACCEL_THRESHOLD) {\r\n accelY++;\r\n }\r\n if (Math.abs(lastZ - data.z) > ACCEL_THRESHOLD) {\r\n accelZ++;\r\n }\r\n analyzeResults();\r\n lastX = data.x;\r\n lastY = data.y;\r\n lastZ = data.z;\r\n \r\n data = e.attitude;\r\n $.pitch.message = data.pitch;\r\n $.pitch.value = Math.abs(data.pitch);\r\n $.roll.message = data.roll;\r\n $.roll.value = Math.abs(data.roll);\r\n $.yaw.message = data.yaw;\r\n $.yaw.value = Math.abs(data.yaw);\r\n } else {\r\n if (e.error) Ti.API.error(e.error);\r\n }\r\n}\r\nfunction analyzeResults(){\r\n if (accelX > SHAKE_THRESHOLD || accelY > SHAKE_THRESHOLD || accelZ > SHAKE_THRESHOLD) {\r\n var err = SHAKE_THRESHOLD * 0.5;\r\n if (accelX > SHAKE_THRESHOLD && (accelY < err && accelZ < err)){\r\n alert(\"Quit shaking me back and forth!\");\r\n }\r\n else if (accelY > SHAKE_THRESHOLD && (accelX < err && accelZ < err)){\r\n alert(\"Quit shaking me up and down!\");\r\n }\r\n else if (accelZ > SHAKE_THRESHOLD && (accelX < err && accelY < err)){\r\n alert(\"Why are you shaking me like that?!\");\r\n }\r\n else {\r\n alert(\"Quit shaking me!\");\r\n } \r\n accelX = accelY = accelZ = 0;\r\n }\r\n}\r\n$.pitch.show();\r\n$.roll.show();\r\n$.yaw.show();\r\n$.index.open();\r\n{code}\r\n\r\n3- Add the Core Motion Module\r\n4- Build and run on device\r\n5.- Move and Walk \r\n\r\nThe app will close unexpectedly\r\n\r\nh6.Expected Behavior \r\nThe app should keep working\r\n\r\n\r\n\r\n**Additional notes: \r\nAttached Xcode crash log image.\r\nThis is also happening on the movies sample app", "attachment": [ { "id": "57278", "filename": "Screen Shot 2015-11-06 at 3.01.29 PM.png", "author": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-06T21:40:22.000+0000", "size": 498230, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Core Motion crashes when the user moves", "creator": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS 9.1\r\nXcode 7.1\r\nAppcelerator Studio, build: 4.3.1.201509302304\r\n", "closedSprints": [ { "id": 525, "state": "closed", "name": "2015 Sprint 23 SDK", "startDate": "2015-11-07T01:30:15.519Z", "endDate": "2015-11-21T01:30:00.000Z", "completeDate": "2015-11-23T02:54:27.887Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "369360", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~rramirez] Do you have infos where it it did work? [~cng] [~penrique] This module is also compiled with the old hyperloop, we should clean it up for now just like in MOD-2150, thoughts?.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-08T22:47:28.000+0000", "updated": "2015-11-08T22:53:07.000+0000" }, { "id": "370780", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "This issue was fixed as part of the ti.coremotion refactoring process. The current version can be found [here|https://github.com/appcelerator-modules/ti.coremotion/releases] and will be packed into Ti.SDK 5.2.0 by default. [Docs|https://github.com/appcelerator-modules/ti.coremotion/tree/master/apidoc] and an [example|https://github.com/appcelerator-modules/ti.coremotion/blob/master/iphone/example/app.js] covering every available API is also packed into the module. \r\n\r\nAs we cleaned everything up, the device motion has now its own namespace, the updated sample code following (view and style remain the same):\r\n\r\n{code:javascript}\r\nvar accelX = accelY = accelZ = 0;\r\nvar lastX = lastY = lastZ = 0;\r\nvar ACCEL_THRESHOLD = 2;\r\nvar SHAKE_THRESHOLD = 5;\r\nvar CoreMotion = require('ti.coremotion');\r\nvar DeviceMotion = CoreMotion.createDeviceMotion();\r\n\r\nif (DeviceMotion.isDeviceMotionAvailable()) {\r\n DeviceMotion.setDeviceMotionUpdateInterval(500);\r\n var frames = DeviceMotion.availableAttitudeReferenceFrames();\r\n var ref_frame = CoreMotion.ATTITUDE_REFERENCE_FRAME_X_TRUE_NORTH_Z_VERTICAL;\r\n if (frames & ref_frame) {\r\n // Use the True North Frame if available\r\n Ti.API.debug('REFERENCE FRAME: True North');\r\n DeviceMotion.startDeviceMotionUpdatesUsingReferenceFrame(\r\n {referenceFrame: ref_frame},\r\n updateMotionData \r\n );\r\n }\r\n else if (ref_frame = DeviceMotion.getAttitudeReferenceFrame()) {\r\n // Use the default frame if it exists\r\n Ti.API.debug('REFERENCE FRAME: Default ' + ref_frame);\r\n DeviceMotion.startDeviceMotionUpdatesUsingReferenceFrame(\r\n {referenceFrame: ref_frame},\r\n updateMotionData \r\n ); \r\n } else {\r\n // Do not use a reference frame\r\n Ti.API.debug('REFERENCE FRAME: None');\r\n DeviceMotion.startDeviceMotionUpdates(updateMotionData);\r\n }\r\n}\r\nfunction updateMotionData (e) {\r\n \r\n if (e.success) { \r\n var data = e.userAcceleration;\r\n if (Math.abs(lastX - data.x) > ACCEL_THRESHOLD) {\r\n accelX++;\r\n }\r\n if (Math.abs(lastY - data.y) > ACCEL_THRESHOLD) {\r\n accelY++;\r\n }\r\n if (Math.abs(lastZ - data.z) > ACCEL_THRESHOLD) {\r\n accelZ++;\r\n }\r\n analyzeResults();\r\n lastX = data.x;\r\n lastY = data.y;\r\n lastZ = data.z;\r\n \r\n data = e.attitude;\r\n $.pitch.message = data.pitch;\r\n $.pitch.value = Math.abs(data.pitch);\r\n $.roll.message = data.roll;\r\n $.roll.value = Math.abs(data.roll);\r\n $.yaw.message = data.yaw;\r\n $.yaw.value = Math.abs(data.yaw);\r\n } else {\r\n if (e.error) Ti.API.error(e.error);\r\n }\r\n}\r\nfunction analyzeResults(){\r\n if (accelX > SHAKE_THRESHOLD || accelY > SHAKE_THRESHOLD || accelZ > SHAKE_THRESHOLD) {\r\n var err = SHAKE_THRESHOLD * 0.5;\r\n if (accelX > SHAKE_THRESHOLD && (accelY < err && accelZ < err)){\r\n alert(\"Quit shaking me back and forth!\");\r\n }\r\n else if (accelY > SHAKE_THRESHOLD && (accelX < err && accelZ < err)){\r\n alert(\"Quit shaking me up and down!\");\r\n }\r\n else if (accelZ > SHAKE_THRESHOLD && (accelX < err && accelY < err)){\r\n alert(\"Why are you shaking me like that?!\");\r\n }\r\n else {\r\n alert(\"Quit shaking me!\");\r\n } \r\n accelX = accelY = accelZ = 0;\r\n }\r\n}\r\n$.pitch.show();\r\n$.roll.show();\r\n$.yaw.show();\r\n$.index.open();\r\n{code}\r\n\r\nThanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-19T03:02:09.000+0000", "updated": "2015-11-19T03:03:36.000+0000" }, { "id": "370830", "author": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The module is working great ! Thank you guys!", "updateAuthor": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-19T16:55:59.000+0000", "updated": "2015-11-19T16:55:59.000+0000" }, { "id": "374854", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed. Verified that if I use ti.coremotion (2.0.0), the app will not crash when I move around or leave the app idle.\r\n\r\nTested on:\r\n\r\nAppc CLI NPM: 4.2.2\r\nAppc CLI Core: 5.2.0-229\r\nti.coremotion: 2.0.0\r\nSDK: 5.2.0.v20160114021251\r\nNode: v4.2.4\r\nOS: El Capitan (10.11.2)\r\nXcode: 7.2\r\nDevices: iphone 6 (9.2)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-01-19T19:19:00.000+0000", "updated": "2016-01-19T19:19:00.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }