Bug fix: can not remove overlays sometimes
MODIFY
src/ios/GoogleMaps/PluginMap.h
src/ios/GoogleMaps/PluginMap.h
@interface PluginMap : CDVPlugin<MyPlgunProtocol>
@property (nonatomic, strong) GoogleMapsViewController* mapCtrl;
@property (nonatomic) BOOL isRemoved;
-@property (nonatomic) NSOperationQueue *loadPluginQueue;
@property (nonatomic) NSOperationQueue *executeQueue;
- (void)clear:(CDVInvokedUrlCommand*)command;

MODIFY
src/ios/GoogleMaps/PluginMap.m
src/ios/GoogleMaps/PluginMap.m
NSString *pluginName = [NSString stringWithFormat:@"%@", className];
className = [NSString stringWithFormat:@"Plugin%@", className];
-
- [self.loadPluginQueue addOperationWithBlock: ^{
+ @synchronized (self) {
CDVPluginResult* pluginResult = nil;
CDVPlugin<MyPlgunProtocol> *plugin;
[cdvViewController.pluginsMap setValue:pluginId forKey:pluginId];
[plugin pluginInitialize];
- //NSLog(@"--->loadPlugin : %@ className : %@", pluginId, className);
+ //NSLog(@"--->loadPlugin : %@ className : %@, plugin : %@", pluginId, className, plugin);
[self.mapCtrl.plugins setObject:plugin forKey:pluginId];
[plugin setGoogleMapsViewController:self.mapCtrl];
messageAsString:[NSString stringWithFormat:@"method not found: %@ in %@ class", @"create", className]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- }];
+ }
}
- (void)getMap:(CDVInvokedUrlCommand*)command {
- self.loadPluginQueue = [NSOperationQueue new];
self.executeQueue = [NSOperationQueue new];
if ([command.arguments count] == 1) {
[self.mapCtrl.map clear];
});
- if (self.loadPluginQueue != nil){
- self.loadPluginQueue.suspended = YES;
- [self.loadPluginQueue cancelAllOperations];
- self.loadPluginQueue.suspended = NO;
- }
-
CDVViewController *cdvViewController = (CDVViewController*)self.viewController;
CDVPlugin<MyPlgunProtocol> *plugin;

Bug fix: can not remove overlays sometimes (#1432)