(iOS) Fix: Prevent crash when the app uses WKWebView with ionic, and you specified a relative path for marker
MODIFY
README.md
README.md
@@ -70,6 +70,7 @@ $> cordova plugin add cordova-plugin-googlemaps \
- Add: Use `android-support-library-v4`
- Fix: `cordova-plugin-gooelmaps.CordovaGoogleMaps is already defined warning` message.
- Update: `com.googlemaps.ios@2.6.0` is required. Please reinstall the plugin.
+ - Add: This plugin messages are localized for English and Japanese.
---

MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.2.4-beta-20180212-1500" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.2.4-beta-20180212-1610" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
src/ios/GoogleMaps/PluginGroundOverlay.m
src/ios/GoogleMaps/PluginGroundOverlay.m
if (![[url lastPathComponent] isEqualToString:@"/"]) {
currentURL = [currentURL stringByDeletingLastPathComponent];
}
+
+ // remove page unchor (i.e index.html#page=test, index.html?key=value)
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[#\\?].*$" options:NSRegularExpressionCaseInsensitive error:nil];
+ currentURL = [regex stringByReplacingMatchesInString:currentURL options:0 range:NSMakeRange(0, [currentURL length]) withTemplate:@""];
+
+ // remove file name (i.e /index.html)
+ regex = [NSRegularExpression regularExpressionWithPattern:@"\\/[^\\/]+\\.[^\\/]+$" options:NSRegularExpressionCaseInsensitive error:nil];
+ currentURL = [regex stringByReplacingMatchesInString:currentURL options:0 range:NSMakeRange(0, [currentURL length]) withTemplate:@""];
+
+
NSString *urlStr2 = [NSString stringWithFormat:@"%@/%@", currentURL, urlStr];
urlStr2 = [urlStr2 stringByReplacingOccurrencesOfString:@":/" withString:@"://"];
urlStr2 = [urlStr2 stringByReplacingOccurrencesOfString:@":///" withString:@"://"];

MODIFY
src/ios/GoogleMaps/PluginMarker.m
src/ios/GoogleMaps/PluginMarker.m
if (![[url lastPathComponent] isEqualToString:@"/"]) {
currentURL = [currentURL stringByDeletingLastPathComponent];
}
+ // remove page unchor (i.e index.html#page=test, index.html?key=value)
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[#\\?].*$" options:NSRegularExpressionCaseInsensitive error:nil];
+ currentURL = [regex stringByReplacingMatchesInString:currentURL options:0 range:NSMakeRange(0, [currentURL length]) withTemplate:@""];
+
+ // remove file name (i.e /index.html)
+ regex = [NSRegularExpression regularExpressionWithPattern:@"\\/[^\\/]+\\.[^\\/]+$" options:NSRegularExpressionCaseInsensitive error:nil];
+ currentURL = [regex stringByReplacingMatchesInString:currentURL options:0 range:NSMakeRange(0, [currentURL length]) withTemplate:@""];
+
//url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", currentURL, iconPath]];
currentURL = [NSString stringWithFormat:@"%@/%@", currentURL, iconPath];
currentURL = [currentURL stringByReplacingOccurrencesOfString:@":/" withString:@"://"];

(iOS) Fix: Prevent crash when the app uses WKWebView with ionic, and you specified a relative path for marker