usernotifications

Unable to update local scheduled notification content

早过忘川 提交于 2019-12-22 06:35:22
问题 In one of the WWDC sessions I got code snippet for updating existing notifications. I don't think it works. Trying to update notification content. First I request pending notifications from UNUserNotificationCenter which always works. Then I am creating new request to update notification with existing unique identifier. There's 1 new variable content: String . // Got at least one pending notification. let triggerCopy = request!.trigger as! UNTimeIntervalNotificationTrigger let interval =

Check whether user notifications are enabled after UILocalNotification deprecation

好久不见. 提交于 2019-12-22 03:43:36
问题 In my app, I want to be able to check if the user has notifications enabled or not. In iOS 10, I did this using a check in the delegate. This check is now deprecated and I want to update it, but I can't figure out what to use in iOS 11. The deprecation warning is as follows: currentUserNotificationSettings' was deprecated in iOS 10.0: Use UserNotifications Framework's -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] and -[UNUserNotificationCenter

Does UNTimeIntervalNotificationTrigger nextTriggerDate() give the wrong date?

与世无争的帅哥 提交于 2019-12-21 12:47:50
问题 I’m updating my localnotifications to work with iOS 10 and I’ve run into an issue where I think the nextTrigger function returns NOT “The next date at which the trigger conditions will be met.” but instead returns whatever the current date time is PLUS what you had initially set the UNTimeInvervalNotificationTrigger to. So if you set the trigger to go off in 60 seconds, from the documentation I expect that when I call the nextTriggerDate() that I’d get it to return whatever the date time is

Does UNTimeIntervalNotificationTrigger nextTriggerDate() give the wrong date?

♀尐吖头ヾ 提交于 2019-12-21 12:47:06
问题 I’m updating my localnotifications to work with iOS 10 and I’ve run into an issue where I think the nextTrigger function returns NOT “The next date at which the trigger conditions will be met.” but instead returns whatever the current date time is PLUS what you had initially set the UNTimeInvervalNotificationTrigger to. So if you set the trigger to go off in 60 seconds, from the documentation I expect that when I call the nextTriggerDate() that I’d get it to return whatever the date time is

Switching to Xcode 10 causes `UserNotifications.framekwor dyld: Library not loaded crash` for iOS9

…衆ロ難τιáo~ 提交于 2019-12-20 06:04:12
问题 We have an app that is working properly with the UserNotification.framework being linked as required framework in Xcode 9. Everything works smooth here. Now we are switching to Xcode 10. But there linking this framework as required leads to dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications Referenced from: /var/containers/Bundle/Application/1D41BD68-9B88-4D5D-B7AB-0D1C31979964/App.app/App Reason: image not found If I switch it to optional push

UserNotification is not showing (iOS 10)

萝らか妹 提交于 2019-12-20 04:24:24
问题 I am unable to fire a UserNotification in iOS 10. I will start with my code: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; UNAuthorizationOptions options = (UNAuthorizationOptionBadge | UNAuthorizationOptionAlert | UNAuthorizationOptionSound); center.delegate = self; [center requestAuthorizationWithOptions: options completionHandler: ^

Display image in notification bar with remote notification(Rich media push notification) in iOS 10

我的未来我决定 提交于 2019-12-19 08:52:05
问题 I have integrated APNS and want to display image in remote notification like below; I have used below code with reference link; AppDelegate.h #import <UserNotifications/UserNotifications.h> @interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate> AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self registerForRemoteNotification]; UIStoryboard *storyboard = [UIStoryboard

Multiple UNUserNotifications not firing

老子叫甜甜 提交于 2019-12-17 16:51:00
问题 I'm setting multiple UNUsernotifications as below, - (void)viewDidLoad { [super viewDidLoad]; notifCount = 0; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (!error) { NSLog(@"request succeeded!"); [self set10Notif]; } }]; } In the set10Notif method, I'm setting

Multiple UNUserNotifications not firing

好久不见. 提交于 2019-12-17 16:50:03
问题 I'm setting multiple UNUsernotifications as below, - (void)viewDidLoad { [super viewDidLoad]; notifCount = 0; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (!error) { NSLog(@"request succeeded!"); [self set10Notif]; } }]; } In the set10Notif method, I'm setting

How to remove a remote notification from notification center using UserNotifications framework

让人想犯罪 __ 提交于 2019-12-12 21:07:17
问题 I have seen several threads on this here and elsewhere but none seem to be using the new UserNotifications framework for iOS 10 There is an instance method getDeliveredNotifications(completionHandler:) that is called on UNUserNotificationCenter singleton function current() The completionHandler: takes an array of delivered notifications that could then be removed inside the block using removeDeliveredNotifications(withIdentifiers:) UNUserNotificationCenter.current().getDeliveredNotifications