update: for iOS11
MODIFY
src/ios/GoogleMaps/CordovaGoogleMaps.m
src/ios/GoogleMaps/CordovaGoogleMaps.m
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:nil];
#endif
self.executeQueue = [NSOperationQueue new];
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
//-------------------------------
// Check the Google Maps API key
//-------------------------------
}
[self.viewController.view addSubview:self.pluginLayer];
+ }];
}
- (void) didRotate:(id)sender
bearing: bearing
viewingAngle: angle];
- pluginMap.mapCtrl.map = [GMSMapView mapWithFrame:rect camera:camera];
+ mapCtrl.map = [GMSMapView mapWithFrame:rect camera:camera];
//mapType
NSString *typeStr = [initOptions valueForKey:@"mapType"];
//indoor display
pluginMap.mapCtrl.map.indoorDisplay.delegate = mapCtrl;
- [mapCtrl.view addSubview:pluginMap.mapCtrl.map];
-
+ [mapCtrl.view addSubview:mapCtrl.map];
[self.pluginLayer addMapView:mapCtrl];
+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[pluginMap getMap:command];
});

MODIFY
src/ios/GoogleMaps/PluginMap.m
src/ios/GoogleMaps/PluginMap.m
-(void)_changeCameraPosition: (NSString*)action requestMethod:(NSString *)requestMethod params:(NSDictionary *)json command:(CDVInvokedUrlCommand *)command {
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
__block double bearing;
if ([json valueForKey:@"bearing"]) {
bearing = [[json valueForKey:@"bearing"] doubleValue];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
if ([action isEqual: @"animateCamera"]) {
[CATransaction begin]; {
[CATransaction setAnimationDuration: duration];
- (void)_setOptions:(NSDictionary *)initOptions requestMethod:(NSString *)requestMethod command:(CDVInvokedUrlCommand *)command {
- [self.mapCtrl.executeQueue addOperationWithBlock:^{
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
BOOL isEnabled = NO;
//controls
//compass
if ([controls valueForKey:@"compass"] != nil) {
isEnabled = [[controls valueForKey:@"compass"] boolValue];
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
if (isEnabled == true) {
self.mapCtrl.map.settings.compassButton = YES;
} else {
self.mapCtrl.map.settings.compassButton = NO;
}
- }];
}
//myLocationButton
if ([controls valueForKey:@"myLocationButton"] != nil) {
isEnabled = [[controls valueForKey:@"myLocationButton"] boolValue];
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
if (isEnabled == true) {
self.mapCtrl.map.settings.myLocationButton = YES;
self.mapCtrl.map.myLocationEnabled = YES;
self.mapCtrl.map.settings.myLocationButton = NO;
self.mapCtrl.map.myLocationEnabled = NO;
}
- }];
}
//indoorPicker
if ([controls valueForKey:@"indoorPicker"] != nil) {
isEnabled = [[controls valueForKey:@"indoorPicker"] boolValue];
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
if (isEnabled == true) {
self.mapCtrl.map.settings.indoorPicker = YES;
} else {
self.mapCtrl.map.settings.indoorPicker = NO;
}
- }];
}
} else {
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.mapCtrl.map.settings.compassButton = YES;
- }];
}
//gestures
//rotate
if ([gestures valueForKey:@"rotate"] != nil) {
isEnabled = [[gestures valueForKey:@"rotate"] boolValue];
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.mapCtrl.map.settings.rotateGestures = isEnabled;
- }];
}
//scroll
if ([gestures valueForKey:@"scroll"] != nil) {
isEnabled = [[gestures valueForKey:@"scroll"] boolValue];
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.mapCtrl.map.settings.scrollGestures = isEnabled;
- }];
}
//tilt
if ([gestures valueForKey:@"tilt"] != nil) {
isEnabled = [[gestures valueForKey:@"tilt"] boolValue];
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.mapCtrl.map.settings.tiltGestures = isEnabled;
- }];
}
//zoom
if ([gestures valueForKey:@"zoom"] != nil) {
isEnabled = [[gestures valueForKey:@"zoom"] boolValue];
-
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.mapCtrl.map.settings.zoomGestures = isEnabled;
- }];
}
}
//preferences
}
UIEdgeInsets newPadding = UIEdgeInsetsMake(current.top, current.left, current.bottom, current.right);
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.mapCtrl.map setPadding:newPadding];
- }];
}
//zoom
if ([preferences valueForKey:@"zoom"] != nil) {
maxZoom = [[zoom objectForKey:@"maxZoom"] doubleValue];
}
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.mapCtrl.map setMinZoom:minZoom maxZoom:maxZoom];
- }];
}
}
NSError *error;
GMSMapStyle *mapStyle = [GMSMapStyle styleWithJSONString:styles error:&error];
if (mapStyle != nil) {
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.mapCtrl.map.mapStyle = mapStyle;
self.mapCtrl.map.mapType = kGMSTypeNormal;
- }];
} else {
NSLog(@"Your specified map style is incorrect : %@", error.description);
}
if (caseBlock) {
// Change the map type
mapType = caseBlock();
-
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.mapCtrl.map.mapType = mapType;
- }];
}
}
}
// Redraw the map mandatory
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.mapCtrl.map setNeedsDisplay];
- }];
if ([initOptions valueForKey:@"camera"]) {

update: for iOS11