You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin returns native location data without causing the app to crash.
What does actually happen?
The plugin sometimes causes the app to crash when attempting to return native location data.
Information
Firebase has reported a spike in crashes the iOS versions of several of my apps.
The Crashlytics data indicates the crashes are only occurring on devices running iOS 14.
The stack trace indicates the crash originates in the geolocation plugin because one of the values being extracted from the native location object has an infinite value and therefore an exception is raised when trying to extract the values and transform then into a JSON object.
This can be resolved by checking the NSMutableDictionary, into which the values from the CLLocation object are copied, is valid for conversion to JSON before attempting the conversion.
I'm not certain exactly which value retrieved from the CLLocation object is INFINITY because the stack trace from the crash only points to the line where the conversion to JSON is attempted but doesn't actually indicate which field in the NSMutableDictionary contains the INFINITE value.
However, the issue can be artificially reproduced by setting one of the values to INFINITY before the conversion is made, e.g. on line 293 of CDVLocation.m:
Bug Report
Problem
What is expected to happen?
The plugin returns native location data without causing the app to crash.
What does actually happen?
The plugin sometimes causes the app to crash when attempting to return native location data.
Information
Firebase has reported a spike in crashes the iOS versions of several of my apps.
The Crashlytics data indicates the crashes are only occurring on devices running iOS 14.
The stack trace indicates the crash originates in the geolocation plugin because one of the values being extracted from the native location object has an infinite value and therefore an exception is raised when trying to extract the values and transform then into a JSON object.
This can be resolved by checking the
NSMutableDictionary
, into which the values from theCLLocation
object are copied, is valid for conversion to JSON before attempting the conversion.Example crash stacktrace:
Command or Code
I'm not certain exactly which value retrieved from the
CLLocation
object isINFINITY
because the stack trace from the crash only points to the line where the conversion to JSON is attempted but doesn't actually indicate which field in theNSMutableDictionary
contains theINFINITE
value.However, the issue can be artificially reproduced by setting one of the values to
INFINITY
before the conversion is made, e.g. on line 293 ofCDVLocation.m
:Environment, Platform, Device
Devices/Simulators running iOS 14.x
Version information
cordova@10.0.0
cordova-ios@6.1.0
cordova-plugin-geolocation@4.1.0
Checklist
The text was updated successfully, but these errors were encountered: