Bug fix: (iOS) App terminated by GMSThreadException when marker url isn't valid
MODIFY
package.json
package.json
{
"name": "cordova-plugin-googlemaps",
- "version": "2.6.0",
+ "version": "2.6.1-beta-20190422-1817",
"description": "Google Maps native SDK for Android and iOS, and Google Maps JavaScript API v3 for browser.",
"cordova": {
"id": "cordova-plugin-googlemaps",

MODIFY
src/ios/GoogleMaps/PluginMarker.m
src/ios/GoogleMaps/PluginMarker.m
//url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", currentURL, iconPath]];
currentURL = [NSString stringWithFormat:@"%@/%@", currentURL, iconPath];
- currentURL = [currentURL regReplace:@"\\/.\\/" replaceTxt:@"/" options:0];
+ currentURL = [currentURL regReplace:@"\\/\\.\\/" replaceTxt:@"/" options:0];
currentURL = [currentURL regReplace:@"\\/+" replaceTxt:@"/" options:0];
currentURL = [currentURL stringByReplacingOccurrencesOfString:@":/" withString:@"://"];
currentURL = [currentURL stringByReplacingOccurrencesOfString:@":///" withString:@"://"];
[self downloadImageWithURL:url completionBlock:^(BOOL succeeded, UIImage *image) {
if (!succeeded) {
+ dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"[fail] url = %@", url);
// The `visible` property
if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
}
callbackBlock(NO, [NSString stringWithFormat:@"Can not load image from '%@'.", url]);
+ });
return;
}
// Load the icon from over the internet
//
- iconPath = [iconPath regReplace:@"\\/.\\/" replaceTxt:@"/" options:0];
+ iconPath = [iconPath regReplace:@"\\/\\.\\/" replaceTxt:@"/" options:0];
iconPath = [iconPath regReplace:@"\\/+" replaceTxt:@"/" options:0];
iconPath = [iconPath stringByReplacingOccurrencesOfString:@":/" withString:@"://"];
NSURL *url = [NSURL URLWithString:iconPath];
[self downloadImageWithURL:url completionBlock:^(BOOL succeeded, UIImage *image) {
if (!succeeded) {
+ dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"[fail] url = %@", url);
// The `visible` property
if (iconProperty[@"visible"] == [NSNumber numberWithBool:true]) {
}
callbackBlock(NO, [NSString stringWithFormat:@"Can not load image from '%@'.", url]);
+ });
return;
}

Bug fix: (iOS) App terminated by GMSThreadException when marker url isn't valid #2605