bug fix: can not display icon image when the app uses the `cordova-plugin-wkwebview-engine` plugin
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta2-20170607-1043" 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.0.0-beta2-20170615-1407" 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/PluginMarker.m
src/ios/GoogleMaps/PluginMarker.m
}
NSRange range = [iconPath rangeOfString:@"http"];
+ if (range.location != 0) {
+
+ range = [iconPath rangeOfString:@"://"];
+ if (range.location == NSNotFound) {
+
+ range = [iconPath rangeOfString:@"/"];
+ if (range.location != 0) {
+ // Get the current URL, then calculate the relative path.
+ CDVViewController *cdvViewController = (CDVViewController*)self.viewController;
+
+ id webview = cdvViewController.webView;
+ NSString *clsName = [webview className];
+ NSURL *url;
+ if ([clsName isEqualToString:@"UIWebView"]) {
+ url = ((UIWebView *)cdvViewController.webView).request.URL;
+ } else {
+ url = [webview URL];
+ }
+ NSString *currentURL = url.absoluteString;
+ currentURL = [currentURL stringByDeletingLastPathComponent];
+
+ range = [currentURL rangeOfString:@"http"];
+ if (range.location != 0) {
+
+ currentURL = [currentURL stringByReplacingOccurrencesOfString:@"file:" withString:@""];
+ currentURL = [currentURL stringByReplacingOccurrencesOfString:@"//" withString:@"/"];
+ iconPath = [NSString stringWithFormat:@"file://%@/%@", currentURL, iconPath];
+ } else {
+ iconPath = [NSString stringWithFormat:@"%@/%@", currentURL, iconPath];
+ }
+ } else {
+ iconPath = [NSString stringWithFormat:@"file://%@", iconPath];
+ }
+ }
+
+ }
+ //NSLog(@"iconPath = %@", iconPath);
+
+ range = [iconPath rangeOfString:@"http"];
if (range.location != 0) {
/**
* Load icon from file or Base64 encoded strings
}
}
- range = [iconPath rangeOfString:@"://"];
- if (range.location == NSNotFound) {
-
- range = [iconPath rangeOfString:@"/"];
- if (range.location != 0) {
- // Get the current URL, then calculate the relative path.
- CDVViewController *cdvViewController = (CDVViewController*)self.viewController;
-
- id webview = cdvViewController.webView;
- NSString *clsName = [webview className];
- NSURL *url;
- if ([clsName isEqualToString:@"UIWebView"]) {
- url = ((UIWebView *)cdvViewController.webView).request.URL;
- } else {
- url = [webview URL];
- }
- NSString *currentURL = url.absoluteString;
- currentURL = [currentURL stringByDeletingLastPathComponent];
- currentURL = [currentURL stringByReplacingOccurrencesOfString:@"file:" withString:@""];
- currentURL = [currentURL stringByReplacingOccurrencesOfString:@"//" withString:@"/"];
- iconPath = [NSString stringWithFormat:@"file://%@/%@", currentURL, iconPath];
- } else {
- iconPath = [NSString stringWithFormat:@"file://%@", iconPath];
- }
- }
-
-
range = [iconPath rangeOfString:@"file://"];
if (range.location != NSNotFound) {
iconPath = [iconPath stringByReplacingOccurrencesOfString:@"file://" withString:@""];

bug fix: can not display icon image when the app uses the `cordova-plugin-wkwebview-engine` plugin