[AC-6501] App Crashes when requesting location
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2020-03-09T15:25:09.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Peter Ladis |
Assignee | Motiur Rahman |
Created | 2020-03-06T19:10:23.000+0000 |
Updated | 2020-03-09T15:25:09.000+0000 |
Description
Appcelerator Command-Line Interface, version 7.1.1
Operating System
Name = Mac OS X
Version = 10.14.6
Architecture = 64bit
# CPUs = 12
Memory = 17179869184
Node.js
Node.js Version = 10.15.3
npm Version = 6.4.1
Titanium CLI
CLI Version = 5.2.1
Titanium SDK
SDK Version = 8.3.1.GA
Repro Steps:
1. Open up the application
2. Make a call to location services, app will crash with this error
Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient) || _CFMZEnabled()
This crash will go away if I add location to the BackgroundMode...however apple fails my app from review with this setting on
Any ideas?
Here is what apple is saying ( if I remove the location setting in pList, appcelerator crashes when asking for current location) Your 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. Next Steps To 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. If 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. Resources For more information, please review the Starting the Significant-Change Location Service and Monitoring Geographical Regions.
[~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.
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. These are
If 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)
@rene. Those are all set in my app Here is the error that pops
@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
It crashes 100 percent of the time. If I put the background mode back in ( app rejects me )...but the app works as designed....
How are you requesting permission? And are you verifying location permission has been given?
@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)
@rene. What are you asking me for?
[~peterladis] So I tried the following Added the following to the plist section of my tiapp
Added the following code in app.js
This prints the following warning, but still works
So 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?@Ewan I think I found it there was a meeting like this Ti.Geolocation.setAllowsBackgroundLocationUpdates(true); I took the tout..and seems to work now --Peter
Glad it worked out!