Commit 60b501ab by Sebastián Katzer

Exec `cancel` in background

parent a1f06920
......@@ -59,19 +59,21 @@
*/
- (void) cancel:(CDVInvokedUrlCommand*)command
{
NSArray* arguments = [command arguments];
NSString* notificationId = [arguments objectAtIndex:0];
NSArray* notifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
for (UILocalNotification *notification in notifications)
{
NSString *id = [notification.userInfo objectForKey:@"id"];
[self.commandDelegate runInBackground:^{
NSArray* arguments = [command arguments];
NSString* notificationId = [arguments objectAtIndex:0];
NSArray* notifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
if ([notificationId isEqualToString:id])
for (UILocalNotification* notification in notifications)
{
[[UIApplication sharedApplication] cancelLocalNotification:notification];
NSString* id = [notification.userInfo objectForKey:@"id"];
if ([notificationId isEqualToString:id])
{
[[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