Question

How to detect local(not push notification) notifications are allowed or not ? I'm going to integrate local notifications with my app, and for app functionality is very important to detect are local notifications allowed or not.

Était-ce utile?

La solution

Local notifications are always allowed and are available as any other functionality in iOS SDK. Push notifications, however, require special signature for the app to work. Read more about that in Developer docs.

If your app is frontmost and requires to respond to local notification, just implement method application:didReceiveLocalNotification: If it's not, then implement functionality, that is described in Apple Developer docs in method application:didFinishLaunchingWithOptions:

Autres conseils

As I know user can not disable local notification. So, you do not need to check availability of them.

Use CLLocationManager Delegate if user not allow location service the delegate call:

- (void)locationManager:(CLLocationManager *)manager
   didFailWithError:(NSError *)error;

And when the notification service allow you can use local notification whit this function:

- (void)startMonitoringForRegion:(CLRegion *)region
             desiredAccuracy:(CLLocationAccuracy)accuracy __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA,__IPHONE_4_0, __IPHONE_6_0);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top