Mike Benoit created CB-12466:
--------------------------------
Summary: libc++abi.dylib: terminating with uncaught exception of
type std::logic_error: basic_string::_S_construct NULL not valid
Key: CB-12466
URL: https://issues.apache.org/jira/browse/CB-12466
Project: Apache Cordova
Issue Type: Bug
Components: Plugin Geolocation
Affects Versions: 6.3.0
Environment: iOS v9.3.5
Reporter: Mike Benoit
Priority: Critical
We were running into strange crashes on a WIFI only iPad Mini running iOS
v9.3.5 when WIFI was disabled, the error was:
libc++abi.dylib: terminating with uncaught exception of type std::logic_error:
basic_string::_S_construct NULL not valid
We eventually traced it back to the following code, that only crashed when the
error message returned from the OS contained a special character. See the
comments where we force the error message to the one returned by the OS with a
special character vs. a test message without that one character.
- (void)locationManager:(CLLocationManager*)manager
didFailWithError:(NSError*)error
{
NSLog(@"locationManager::didFailWithError %@", [error
localizedFailureReason]);
CDVLocationData* lData = self.locationData;
if (lData && __locationStarted) {
// TODO: probably have to once over the various error codes and return
one of:
// PositionError.PERMISSION_DENIED = 1;
// PositionError.POSITION_UNAVAILABLE = 2;
// PositionError.TIMEOUT = 3;
NSUInteger positionError = POSITIONUNAVAILABLE;
if (error.code == kCLErrorDenied) {
positionError = PERMISSIONDENIED;
}
// Issue #1279 - seems cordova framework does not support characer
’ (Alt + 0180)
NSString *errorMessage = @"The operation couldn’t be completed.
(kCLErrorDomain error 0.)"; //App crashes
//NSString *errorMessage = @"The operation couldn't be completed.
(kCLErrorDomain error 0.)"; //App does not crash
//[self returnLocationError:positionError withMessage:[error
localizedDescription]];
[self returnLocationError:positionError withMessage:errorMessage];
}
if (error.code != kCLErrorLocationUnknown) {
[self.locationManager stopUpdatingLocation];
__locationStarted = NO;
}
}
We were not able to replicate this issue on iOS v10+ though, however it did
seem to be somewhat timing related as to when that specific error message was
returned and therefore causes the crash.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]