apple-push-notifications

Getting Remote Notification Device Token in Swift 4?

安稳与你 提交于 2020-07-05 07:34:32
问题 I am using this code to get the Notification Center Device token. It was working in Swift 3 but not working in Swift 4. What changed? if #available(iOS 10.0, *) { let center = UNUserNotificationCenter.current() center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in } } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})

How to delete delivered notifications from notification service extension

和自甴很熟 提交于 2020-06-28 06:13:07
问题 We are using notification service extension to display 2 types of notifications: call and cancel. The former displays message "You are being called". The second one will display "You were called". When it comes to the latter notification, we want to remove all previously created call notifications still active in notification center. This must work when app is on background and terminated as well. For that, we could use UNUserNotificationCenter.current().removeDeliveredNotifications . However

iOS RemoteNotification swizzler infinity loop by two libraries

人盡茶涼 提交于 2020-06-26 14:57:52
问题 In my app, I'm using Mixpanel iPhone library to record usage, and Firebase iOS SDK Messaging library to handle notifications. The issue happens when the iOS app is in the background, after user tap on a notification toast, app launches but will crash in a few seconds. The failure appears to be an EXC_BAD_ACCESS from Mixpanel's mp_swizzledMethod_5 function. While digging into the call stack I found that Mixpanel's mp_swizzledMethod_5 and Firebase's FCM_swizzle

Swift Local push notification action view

亡梦爱人 提交于 2020-06-25 06:30:40
问题 I'm trying to create a notification with two possible action buttons like "Quick reply" and "Cancel", but I can't find any code examples for this. Please could someone explain how to do this in Swift 3. 回答1: It's difficult to give a precise example of what you are looking for. Here's a quick UNUserNotificationCenter implementation with an action. import UserNotifications Define a category ID constant private let categoryID = "Category" Setup and register UNUserNotificationCenter // MARK: -

Swift Local push notification action view

匆匆过客 提交于 2020-06-25 06:30:26
问题 I'm trying to create a notification with two possible action buttons like "Quick reply" and "Cancel", but I can't find any code examples for this. Please could someone explain how to do this in Swift 3. 回答1: It's difficult to give a precise example of what you are looking for. Here's a quick UNUserNotificationCenter implementation with an action. import UserNotifications Define a category ID constant private let categoryID = "Category" Setup and register UNUserNotificationCenter // MARK: -

Firebase Cloud Function Messaging with APNS Token rather than FCM Token

会有一股神秘感。 提交于 2020-06-23 11:48:58
问题 I am trying to setup a Firebase Cloud Function that will trigger a Cloud Messaging with Payload. The received load by the function however contains Apple APNS Tokens rather than FCM Tokens and I don't see any methods in Firebase Admin SDK allowing APNS Token rather than FCM. Does that mean that I have to write my own APNS Provider and not use FCM?! 回答1: Does that mean that I have to write my own APNS Provider and not use FCM?! You could do that. I don't see how this is a shock. In order to

Firebase Cloud Function Messaging with APNS Token rather than FCM Token

泪湿孤枕 提交于 2020-06-23 11:48:27
问题 I am trying to setup a Firebase Cloud Function that will trigger a Cloud Messaging with Payload. The received load by the function however contains Apple APNS Tokens rather than FCM Tokens and I don't see any methods in Firebase Admin SDK allowing APNS Token rather than FCM. Does that mean that I have to write my own APNS Provider and not use FCM?! 回答1: Does that mean that I have to write my own APNS Provider and not use FCM?! You could do that. I don't see how this is a shock. In order to

iOS Silent Push Notification not delivered after device reboot

。_饼干妹妹 提交于 2020-06-17 01:47:45
问题 While testing the delivery of silent notifications (one which has "content-available": 1 in the payload) to my app I noticed that, after device is rebooted notifications are not delivered. Sending the same payload works if the app is running in background or foreground but, after device is rebooted, I do not receive the didReceiveRemoteNotification: callback in AppDelegate . This happens both on iOS 13 and iOS 12 回答1: In short: Your notification was probably delayed by the system and will be

iOS Silent Push Notification not delivered after device reboot

房东的猫 提交于 2020-06-17 01:47:08
问题 While testing the delivery of silent notifications (one which has "content-available": 1 in the payload) to my app I noticed that, after device is rebooted notifications are not delivered. Sending the same payload works if the app is running in background or foreground but, after device is rebooted, I do not receive the didReceiveRemoteNotification: callback in AppDelegate . This happens both on iOS 13 and iOS 12 回答1: In short: Your notification was probably delayed by the system and will be

iOS: APNS Certificate expires in 30 days - how is this related to APN key in Firebase messaging?

a 夏天 提交于 2020-06-15 05:49:05
问题 I am using Firebase Messaging for iOS and Android push notifications. I am using the new "APNs Authentication Key" mechanism and not "APN certificate" I got an email from Apple that my "Push Certificate" will expire in 30 days and per their help document, I need to switch to this new certificate otherwise push services will stop working for my deployed app in 30 days. I'm confused on what to do and whether APNS certificate expiring has any relevance to my app that uses APN Keys. Per Apple's