Fix: can not load data from "http://localhost:8080" on ionic (Fuck ionic local app server!)
MODIFY
src/ios/GoogleMaps/PluginGroundOverlay.m
src/ios/GoogleMaps/PluginGroundOverlay.m
- (void)_setImage:(GMSGroundOverlay *)groundOverlay urlStr:(NSString *)urlStr completionHandler:(void (^)(BOOL succeeded))completionHandler {
+
NSRange range = [urlStr rangeOfString:@"http"];
if (range.location != 0) {
NSString *iconPath = url.absoluteString;
- if ([iconPath hasPrefix:@"file://"]) {
+ // Since ionic local server declines HTTP access for some reason,
+ // replace URL with file path
+ NSBundle *mainBundle = [NSBundle mainBundle];
+ NSString *wwwPath = [mainBundle pathForResource:@"www/cordova" ofType:@"js"];
+ wwwPath = [wwwPath stringByReplacingOccurrencesOfString:@"/cordova.js" withString:@""];
+ iconPath = [iconPath stringByReplacingOccurrencesOfString:@"http://localhost:8080" withString: wwwPath];
+
+ if ([iconPath hasPrefix:@"file://"] || [iconPath hasPrefix:@"/"]) {
iconPath = [iconPath stringByReplacingOccurrencesOfString:@"file://" withString:@""];
if (![iconPath hasPrefix:@"/"]) {
iconPath = [NSString stringWithFormat:@"/%@", iconPath];

MODIFY
src/ios/GoogleMaps/PluginKmlOverlay.m
src/ios/GoogleMaps/PluginKmlOverlay.m
urlStr = [urlStr stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
NSError *error;
TBXML *tbxml = [TBXML alloc];// initWithXMLFile:urlStr error:&error];
+
+ // Since ionic local server declines HTTP access for some reason,
+ // replace URL with file path
+ NSBundle *mainBundle = [NSBundle mainBundle];
+ NSString *wwwPath = [mainBundle pathForResource:@"www/cordova" ofType:@"js"];
+ wwwPath = [wwwPath stringByReplacingOccurrencesOfString:@"/cordova.js" withString:@""];
+ urlStr = [urlStr stringByReplacingOccurrencesOfString:@"http://localhost:8080" withString: wwwPath];
+
+
if ([urlStr hasPrefix:@"http://"] || [urlStr hasPrefix:@"https://"]) {
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]];
bool valid = [NSURLConnection canHandleRequest:req];

MODIFY
src/ios/GoogleMaps/PluginMarker.m
src/ios/GoogleMaps/PluginMarker.m
{
[self.mapCtrl.executeQueue addOperationWithBlock:^{
- if ([url.absoluteString hasPrefix:@"file:"]) {
- NSString *iconPath = [url.absoluteString stringByReplacingOccurrencesOfString:@"file:" withString:@""];
+ NSString *urlStr = url.absoluteString;
+ // Since ionic local server declines HTTP access for some reason,
+ // replace URL with file path
+ NSBundle *mainBundle = [NSBundle mainBundle];
+ NSString *wwwPath = [mainBundle pathForResource:@"www/cordova" ofType:@"js"];
+ wwwPath = [wwwPath stringByReplacingOccurrencesOfString:@"/cordova.js" withString:@""];
+ urlStr = [urlStr stringByReplacingOccurrencesOfString:@"http://localhost:8080" withString: wwwPath];
+
+ if ([urlStr hasPrefix:@"file:"] || [urlStr hasPrefix:@"/"]) {
+ NSString *iconPath = [urlStr stringByReplacingOccurrencesOfString:@"file:" withString:@""];
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:iconPath]) {
NSLog(@"(error)There is no file at '%@'.", iconPath);

Fix: can not load data from "http://localhost:8080" on ionic (Fuck ionic local app server!)