Cant cancel all local notifications in iOS9 - ios

When i have multiple local notifications and i try to cancel them with :
[[UIApplication sharedApplication] cancelAllLocalNotifications];
I keep getting them anyway . i have read there is some bug about it in Xcode 7, and i couldn't find solution for this .
https://forums.developer.apple.com/thread/9226
How can we launch if we cant cancel notifications ?

Related

Notification count showing when application is installed in iOS

When application is installed for the first time I am seeing notification badge count as 1 by default. I am not able to find from where it is coming.
I tried many approaches provided over SO, but none of them worked for me.
Add this code in your AppDelegate.m
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

I can't fetch data in background in iOS

My app does the intended operations when I use Simulate Background Fetch in the Debug tab in Xcode, however, when the app is running on my phone nothing works.
Has this happened to someone before? How did you resolve it?
I'm currently using Swift 2.2 and Xcode 7.3
Did you edit the schema in Run mode for the Launch due to a Background Fetch Event
iOS Background Fetch Not Working Even Though Correct Background Mode Configured
iOS won't allow any app to run in the background unless the app ask for it and it will allow it to run for 10mins only to register for background execution:
- (void)applicationDidEnterBackground:(UIApplication *)application {
UIBackgroundTaskIdentifier identifier;
identifier = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:identifier];
}];
}

iOS 9.2.1, cancel notifcation not working

I'm developing an app having local notification scheduled.
I'm not able to cancel the scheduled notification using the code:
UIApplication *app=[UIApplication sharedApplication];
[app cancelLocalNotification:notification];
The code is working well in previous iOS versions, but it is stopped working in iOS 9.2.1 update.
Can anyone please help me to sort out the issue?
There is a bug in iOS 9.2.1, so cancelLocalNotification methods doesn't work sometimes.
Use cancelLocalAllNotifications and update your logic accordingly.
This should work.
Keep your localnotification object in NSUSerDefault when it is scheduling, even if your device gets restart you can retrieve localnotification object from NSUSerDefault. So then after you can easily pass that object in cancelLocalNotification(localNotificationObject) and remove it.

iOS - settings page how to remove just notifications

I have a IOS settings screen (on ios 8.0) which gets generated using this code:
[[UIApplication sharedApplication] registerUserNotificationSettings:
[UIUserNotificationSettings settingsForTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)
categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
the result looked like this it seems:
My goal is to remove just the notifications area but i'd like to let the privacy and 'use cellular data' remain.
On the simulator there is no privacy and 'use Cellular Data' appearing. Is this whole issue because im on a simulator ?
If you use "registerForRemoteNotifications" this settings will be there automatically and can't be omitted. You are not allowed to disable user notifications settings if you want to use notifications.
This could be out of date, but according to Technote 2265:
Resetting the Push Notifications Permissions Alert on iOS
The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.
If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:
Delete your app from the device.
Turn the device off completely and turn it back on.
Go to Settings > General > Date & Time and set the date ahead a day or more.
Turn the device off completely again and turn it back on.

iOS Settings - Notifications: How to remove my App if I do not use local notifications?

I removed the use of local notifications from my app, but it still appears in the iOS Settings -> Notifications. If I do not use local notifications, it makes no sense to show the app in the settings.
Is there a key in info.plist or anything that I have to delete?
The deployment target is iOS 7.0.
Thanks for help.
Try to unregister user notification settings (iOS8+) by calling
if ([[UIApplication sharedApplication] respondsToSelector:#selector(registerUserNotificationSettings:)]) {
[[UIApplication sharedApplication] registerUserNotificationSettings:nil];
}

Resources