[TIMOB-27089] iOS: App crashes when asking for location permissions (SDK 8.1.0+)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-05-23T14:52:13.000+0000 |
Affected Version/s | Release 8.1.0 |
Fix Version/s | Release 8.1.0 |
Components | iOS |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Christopher Williams |
Created | 2019-05-19T11:58:27.000+0000 |
Updated | 2019-07-02T10:55:32.000+0000 |
Description
Our app crashes when asking for location permissions on SDK 8.1.0. The feature has not changed since a while and we noticed the crash after upgrading to latest master. Error:
[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] Reason:
[ERROR] -[__NSMallocBlock__ value]: unrecognized selector sent to instance 0x60000236eee0
[ERROR] Stack trace:
[ERROR] 0 CoreFoundation 0x000000011403b1bb __exceptionPreprocess + 331
[ERROR] 1 libobjc.A.dylib 0x000000010f334735 objc_exception_throw + 48
[ERROR] 2 CoreFoundation 0x0000000114059f44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
[ERROR] 3 CoreFoundation 0x000000011403fed6 ___forwarding___ + 1446
[ERROR] 4 CoreFoundation 0x0000000114041da8 _CF_forwarding_prep_0 + 120
[ERROR] 5 Lambus 0x00000001098366a6 __66-[GeolocationModule locationManager:didChangeAuthorizationStatus:]_block_invoke + 198
[ERROR] 6 Lambus 0x00000001098364ef -[GeolocationModule locationManager:didChangeAuthorizationStatus:] + 495
[ERROR] 7 CoreLocation 0x000000010e99dd74 CLClientStopVehicleHeadingUpdates + 71531
[ERROR] 8 CoreLocation 0x000000010e99da15 CLClientStopVehicleHeadingUpdates + 70668
[ERROR] 9 CoreLocation 0x000000010e988210 CLClientInvalidate + 1351
[ERROR] 10 CoreFoundation 0x0000000113fa062c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
[ERROR] 11 CoreFoundation 0x0000000113f9fde0 __CFRunLoopDoBlocks + 336
[ERROR] 12 CoreFoundation 0x0000000113f9ac2b __CFRunLoopRun + 2779
[ERROR] 13 CoreFoundation 0x0000000113f99e11 CFRunLoopRunSpecific + 625
[ERROR] 14 GraphicsServices 0x0000000118a8d1dd GSEventRunModal + 62
[ERROR] 15 UIKitCore 0x000000011cb0381d UIApplicationMain + 140
[ERROR] 16 Lambus 0x000000010967fcbc main + 988
[ERROR] 17 libdyld.dylib 0x0000000115c13575 start + 1
Some quick research shown that the issue is in the GeolocationModule.m where the callback authorizationCallback
(a JSManagedValue
type) seems to be deallocated already:
TiThreadPerformOnMainThread(^{
NSMutableDictionary *propertiesDict = [TiUtils dictionaryWithCode:code message:errorStr];
[propertiesDict setObject:NUMINT([CLLocationManager authorizationStatus]) forKey:@"authorizationStatus"];
[[authorizationCallback value] callWithArguments:@[ propertiesDict ]];
},
YES);
JS code to reproduce:
/* eslint-disable strict */
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var btn = Ti.UI.createButton({
title: 'Request location permissions'
});
btn.addEventListener('click', function () {
Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, event => {
alert(event);
});
});
win.add(btn);
win.open();
Notes:
* We do have the NSLocationWhenInUseUsageDescription
and NSLocationAlwaysAndWhenInUseUsageDescription
plist keys added.
* We do not use the UIBackgroundModes
key location
since we only request the location while using the app
Attachments
File | Date | Size |
---|---|---|
Locationtest 5-23-19, 11-13 AM.crash | 2019-05-23T18:28:29.000+0000 | 67981 |
Pull: https://github.com/appcelerator/titanium_mobile/pull/10902
*Closing ticket.* fix verified in SDK version
8.2.0.v20190628101943
and SDK version8.1.0.v20190701132634
Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10902