{ "id": "174793", "key": "AC-6501", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2020-03-09T15:25:09.000+0000", "created": "2020-03-06T19:10:23.000+0000", "labels": [], "versions": [], "issuelinks": [ { "id": "58248", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "174233", "key": "AC-6399", "fields": { "summary": "App Crashes when requesting location", "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" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updated": "2020-03-09T15:25:09.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": "Appcelerator Command-Line Interface, version 7.1.1\r\n\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.14.6\r\n Architecture = 64bit\r\n # CPUs = 12\r\n Memory = 17179869184\r\nNode.js\r\n Node.js Version = 10.15.3\r\n npm Version = 6.4.1\r\nTitanium CLI\r\n CLI Version = 5.2.1\r\nTitanium SDK\r\n SDK Version = 8.3.1.GA\r\n\r\n\r\nRepro Steps:\r\n\r\n1. Open up the application\r\n2. Make a call to location services, app will crash with this error\r\n\r\nInvalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient) || _CFMZEnabled()\r\n\r\n\r\nThis crash will go away if I add location to the BackgroundMode...however apple fails my app from review with this setting on\r\n\r\nAny ideas?", "attachment": [], "flagged": false, "summary": "App Crashes when requesting location", "creator": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "454603", "author": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Here is what apple is saying ( if I remove the location setting in pList, appcelerator crashes when asking for current location)\r\n\r\nYour app declares support for location in the UIBackgroundModes key in your Info.plist file but still does not have any features that require persistent location. Apps that declare support for location in the UIBackgroundModes key in your Info.plist file must have features that require persistent location.\r\n\r\nNext Steps\r\n\r\nTo resolve this issue, please revise your app to include features that require the persistent use of real-time location updates while the app is in the background.\r\n\r\nIf your app does not require persistent real-time location updates, please remove the \"location\" setting from the UIBackgroundModes key. You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.\r\n\r\nResources\r\n\r\nFor more information, please review the Starting the Significant-Change Location Service and Monitoring Geographical Regions.", "updateAuthor": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-03-08T17:04:10.000+0000", "updated": "2020-03-08T17:04:41.000+0000" }, { "id": "454606", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~peterladis], please provide some sample code (including necessary additions to tiapp) that reproduces this issue. We need this to make sure that we are reviewing the same code you are using.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-03-09T10:26:54.000+0000", "updated": "2020-03-09T10:26:54.000+0000" }, { "id": "454611", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Do you have the keys for location permission strings in your tiapp? If you don't provide those the app will crash as well when you request.\r\n\r\nThese are \r\n{code}\r\nNSLocationUsageDescription\r\nNSLocationWhenInUseUsageDescription\r\nNSLocationAlwaysAndWhenInUseUsageDescription\r\nNSLocationAlwaysUsageDescription\r\n{code}\r\nIf you only request \"when in use\" you need to provide the first 2 strings in tiapp. If you request always you need to provide all 4 (especially for compatibilty to older iOS versions)", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-09T12:21:53.000+0000", "updated": "2020-03-09T12:21:53.000+0000" }, { "id": "454612", "author": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@rene. Those are all set in my app\r\n\r\nHere is the error that pops\r\n\r\n{code}\r\n[INFO] \b\b \b *** Assertion failure in -[CLLocationManager setAllowsBackgroundLocationUpdates:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreLocationFramework_Sim/CoreLocation-2389.0.8/Framework/CoreLocation/CLLocationManager.m:748\r\n[ERROR] \b\b \bScript Error {\r\n[ERROR] \b\b \b column = 46;\r\n[ERROR] \b\b \b line = 668;\r\n[ERROR] \b\b \b message = \"Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient) || _CFMZEnabled()\";\r\n[ERROR] \b\b \b nativeStack = (\r\n[ERROR] \b\b \b\t0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350\r\n[ERROR] \b\b \b\t1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48\r\n[ERROR] \b\b \b\t2 CoreFoundation 0x00007fff23c70ff8 +[NSException raise:format:arguments:] + 88\r\n[ERROR] \b\b \b\t3 Foundation 0x00007fff256e9b51 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191\r\n[ERROR] \b\b \b\t4 CoreLocation 0x00007fff248587de CLClientStopVehicleHeadingUpdates + 27163\r\n[ERROR] \b\b \b\t5 LilyPad 0x000000010f1f6447 -[GeolocationModule locationManager] + 1111\r\n[ERROR] \b\b \b\t6 LilyPad 0x000000010f1f68d8 -[GeolocationModule startStopLocationManagerIfNeeded] + 312\r\n[ERROR] \b\b \b\t7 LilyPad 0x000000010f1f76d2 -[GeolocationModule getCurrentPosition:] + 754\r\n[ERROR] \b\b \b\t8 CoreFoundation 0x00007fff23c7820c __invoking___ + 140\r\n[ERROR] \b\b \b\t9 CoreFoundation 0x00007fff23c753af -[NSInvocation invoke] + 319\r\n[ERROR] \b\b \b\t10 JavaScriptCore 0x00007fff26a73abb _ZN3JSC24ObjCCallbackFunctionImpl4callEP9JSContextP13OpaqueJSValuemPKPKS3_PS6_ + 411\r\n[ERROR] \b\b \b\t11 JavaScriptCore 0x00007fff26a73504 _ZN3JSCL34objCCallbackFunctionCallAsFunctionEPK15OpaqueJSContextP13OpaqueJSValueS4_mPKPKS3_PS6_ + 244\r\n[ERROR] \b\b \b\t12 JavaScriptCore 0x00007fff26a72e2f _ZN3JSC19APICallbackFunction4callINS_20ObjCCallbackFunctionEEExPNS_9ExecStateE + 511\r\n[ERROR] \b\b \b\t13 ??? 0x000036dd32e01027 0x0 + 60323669217319\r\n[ERROR] \b\b \b\t14 JavaScriptCore 0x00007fff26a490a3 llint_entry + 93226\r\n[ERROR] \b\b \b\t15 JavaScriptCore 0x00007fff26a322cf vmEntryToJavaScript + 200\r\n[ERROR] \b\b \b\t16 JavaScriptCore 0x00007fff26e49260 _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 416\r\n[ERROR] \b\b \b\t17 JavaScriptCore 0x00007fff27096844 _ZN3JSC12profiledCallEPNS_9ExecStateENS_15ProfilingReasonENS_7JSValueENS_8CallTypeERKNS_8CallDataES3_RKNS_7ArgListE + 196\r\n[ERROR] \b\b \b\t18 JavaScriptCore 0x00007fff26a8f928 JSObjectCallAsFunction + 488\r\n[ERROR] \b\b \b\t19 TitaniumKit 0x000000010fa1dc2b TiBindingEventProcess + 667\r\n[ERROR] \b\b \b\t20 TitaniumKit 0x000000010fa3e47c -[KrollContext invoke:] + 109\r\n[ERROR] \b\b \b\t21 TitaniumKit 0x000000010fa3e4ef -[KrollContext enqueue:] + 93\r\n[ERROR] \b\b \b\t22 TitaniumKit 0x000000010fa45a8e TiBindingRunLoopEnqueue + 77\r\n[ERROR] \b\b \b\t23 TitaniumKit 0x000000010fa1dd02 TiBindingEventProcess + 882\r\n[ERROR] \b\b \b\t24 TitaniumKit 0x000000010fa3e47c -[KrollContext invoke:] + 109\r\n[ERROR] \b\b \b\t25 TitaniumKit 0x000000010fa3e4ef -[KrollContext enqueue:] + 93\r\n[ERROR] \b\b \b\t26 TitaniumKit 0x000000010fa45a8e TiBindingRunLoopEnqueue + 77\r\n[ERROR] \b\b \b\t27 TitaniumKit 0x000000010fa442e4 -[TiProxy fireEvent:withObject:propagate:reportSuccess:errorCode:message:] + 164\r\n[ERROR] \b\b \b\t28 TitaniumKit 0x000000010fa25cec -[TiViewProxy fireEvent:withObject:propagate:reportSuccess:errorCode:message:] + 224\r\n[ERROR] \b\b \b\t29 TitaniumKit 0x000000010fa440f1 -[TiProxy fireEvent:withObject:propagate:] + 76\r\n[ERROR] \b\b \b\t30 TitaniumKit 0x000000010fa16a2f -[TiUIView touchesEnded:withEvent:] + 110\r\n[ERROR] \b\b \b\t31 UIKitCore 0x00007fff480cebbf -[UIWindow _sendTouchesForEvent:] + 2604\r\n[ERROR] \b\b \b\t32 UIKitCore 0x00007fff480d04c6 -[UIWindow sendEvent:] + 4596\r\n[ERROR] \b\b \b\t33 UIKitCore 0x00007fff480ab53b -[UIApplication sendEvent:] + 356\r\n[ERROR] \b\b \b\t34 LilyPad 0x000000010f0afdac -[TiUIApplication sendEvent:] + 572\r\n[ERROR] \b\b \b\t35 UIKitCore 0x00007fff4812c71a __dispatchPreprocessedEventFromEventQueue + 6847\r\n[ERROR] \b\b \b\t36 UIKitCore 0x00007fff4812f1e0 __handleEventQueueInternal + 5980\r\n[ERROR] \b\b \b\t37 CoreFoundation 0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17\r\n[ERROR] \b\b \b\t38 CoreFoundation 0x00007fff23bd439c __CFRunLoopDoSource0 + 76\r\n[ERROR] \b\b \b\t39 CoreFoundation 0x00007fff23bd3b74 __CFRunLoopDoSources0 + 180\r\n[ERROR] \b\b \b\t40 CoreFoundation 0x00007fff23bce87f __CFRunLoopRun + 1263\r\n{code}", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-09T12:34:00.000+0000", "updated": "2020-03-09T12:43:03.000+0000" }, { "id": "454613", "author": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Ewan...I am doing nothing special to make this happen....if I remove the LOCATION from the setting for background mode and make this SDK call\r\n\r\n{code:js}\r\nTitanium.Geolocation.getCurrentPosition(function(loc){\r\n});\r\n{code}\r\n\r\nIt crashes 100 percent of the time. \r\n\r\nIf I put the background mode back in ( app rejects me )...but the app works as designed....\r\n\r\n", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-09T12:35:25.000+0000", "updated": "2020-03-09T12:43:49.000+0000" }, { "id": "454614", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "How are you requesting permission? And are you verifying location permission has been given?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-09T12:44:34.000+0000", "updated": "2020-03-09T12:44:34.000+0000" }, { "id": "454615", "author": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@rene....The code is pretty simple and has been like this for years..I have a function that does this. The code is literally cut and paste from the SDK docs. Functioally it all works IF the tiapp. has background location mode enabled(Which apple review team doesn't like)\r\n{code:js}\r\nfunction getLocation(){\r\n\r\n Titanium.Geolocation.getCurrentPosition(function(loc){});\r\n}\r\n\r\nif (Ti.Geolocation.hasLocationPermissions()) {\r\n\t getLocation();\r\n\t } else {\r\n\t Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n\t if (e.success) {\r\n\r\n\t\t\t\t\t\t\t\t getLocation();\r\n\r\n\t } else {\r\n\t //alert('could not obtain location permissions');\r\n\t }\r\n\t });\r\n\r\n\t\t\t}\r\n{code}", "updateAuthor": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-03-09T12:50:34.000+0000", "updated": "2020-03-09T13:18:21.000+0000" }, { "id": "454616", "author": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@rene. What are you asking me for?", "updateAuthor": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-03-09T13:31:33.000+0000", "updated": "2020-03-09T13:31:33.000+0000" }, { "id": "454617", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~peterladis] So I tried the following\r\nAdded the following to the plist section of my tiapp\r\n\r\n{code}\r\nNSLocationUsageDescription\r\nCan we track you?\r\nNSLocationWhenInUseUsageDescription\r\nCan we track you?\r\nNSLocationAlwaysAndWhenInUseUsageDescription\r\nCan we track you?\r\nNSLocationAlwaysUsageDescription\r\nCan we track you?\r\n{code}\r\n\r\nAdded the following code in app.js\r\n{code}\r\nconst win = Ti.UI.createWindow();\r\nconst btn = Ti.UI.createButton({\r\n title: 'get location',\r\n top: 50\r\n});\r\nbtn.addEventListener('click', ()=> {\r\n function getLocation(){\r\n Titanium.Geolocation.getCurrentPosition(function(loc){\r\n console.log(loc);\r\n });\r\n }\r\n if (Ti.Geolocation.hasLocationPermissions()) {\r\n console.log('has');\r\n getLocation();\r\n } else {\r\n Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n if (e.success) {\r\n getLocation();\r\n } else {\r\n console.log(e);\r\n alert('could not obtain location permissions');\r\n }\r\n });\r\n }\r\n});\r\nwin.add(btn);\r\nwin.open();\r\n{code}\r\n\r\nThis prints the following warning, but still works\r\n\r\n{code}\r\n[WARN] Trying to use location services without requesting location permissions. Use either:\r\n[WARN] Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n[WARN] // Handle authorization via e.success\r\n[WARN] })\r\n[WARN] or\r\n[WARN] Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, function(e) {\r\n[WARN] // Handle authorization via e.success\r\n[WARN] })\r\n[WARN] Picking the hightest permission by default.\r\n[INFO] {\r\n[INFO] success: true,\r\n[INFO] code: 0,\r\n[INFO] source: {},\r\n[INFO] type: 'location',\r\n[INFO] coords: {\r\n[INFO] timestamp: 1583763807621,\r\n[INFO] speed: -1,\r\n[INFO] longitude: -6.27044677734375,\r\n[INFO] floor: { level: 0 },\r\n[INFO] latitude: 53.339996337890625,\r\n[INFO] accuracy: 149000,\r\n[INFO] heading: -1,\r\n[INFO] altitude: 0,\r\n[INFO] altitudeAccuracy: -1\r\n[INFO] }\r\n[INFO] }\r\n{code}\r\n\r\nSo I updated the {{hasLocationPermissions}} call like below, this still returns the location and no longer logs the warning. I suspect that maybe there might be something extra in your app that is causing this?\r\n\r\n{code}\r\nconst win = Ti.UI.createWindow();\r\nconst btn = Ti.UI.createButton({\r\n title: 'get location',\r\n top: 50\r\n});\r\nbtn.addEventListener('click', ()=> {\r\n function getLocation(){\r\n Titanium.Geolocation.getCurrentPosition(function(loc){\r\n console.log(loc);\r\n });\r\n }\r\n if (Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS)) {\r\n console.log('has');\r\n getLocation();\r\n } else {\r\n Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n if (e.success) {\r\n getLocation();\r\n } else {\r\n console.log(e);\r\n alert('could not obtain location permissions');\r\n }\r\n });\r\n }\r\n});\r\nwin.add(btn);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-03-09T14:40:10.000+0000", "updated": "2020-03-09T14:40:10.000+0000" }, { "id": "454618", "author": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Ewan I think I found it\r\n\r\nthere was a meeting like this\r\n\r\nTi.Geolocation.setAllowsBackgroundLocationUpdates(true); \r\n\r\nI took the tout..and seems to work now\r\n\r\n--Peter", "updateAuthor": { "name": "peterladis", "key": "peterladis", "displayName": "Peter Ladis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-03-09T15:09:44.000+0000", "updated": "2020-03-09T15:09:44.000+0000" }, { "id": "454619", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Glad it worked out! ", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-09T15:25:09.000+0000", "updated": "2020-03-09T15:25:09.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }