Commit 60b501ab by Sebastián Katzer

Exec `cancel` in background

parent a1f06920
...@@ -59,19 +59,21 @@ ...@@ -59,19 +59,21 @@
*/ */
- (void) cancel:(CDVInvokedUrlCommand*)command - (void) cancel:(CDVInvokedUrlCommand*)command
{ {
[self.commandDelegate runInBackground:^{
NSArray* arguments = [command arguments]; NSArray* arguments = [command arguments];
NSString* notificationId = [arguments objectAtIndex:0]; NSString* notificationId = [arguments objectAtIndex:0];
NSArray* notifications = [[UIApplication sharedApplication] scheduledLocalNotifications]; NSArray* notifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
for (UILocalNotification *notification in notifications) for (UILocalNotification* notification in notifications)
{ {
NSString *id = [notification.userInfo objectForKey:@"id"]; NSString* id = [notification.userInfo objectForKey:@"id"];
if ([notificationId isEqualToString:id]) if ([notificationId isEqualToString:id])
{ {
[[UIApplication sharedApplication] cancelLocalNotification:notification]; [[UIApplication sharedApplication] cancelLocalNotification:notification];
} }
} }
}];
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment