Send communication and Time Sensitive notifications

RSS for tag

Discuss the WWDC21 session Send communication and Time Sensitive notifications.

Posts under wwdc21-10091 tag

23 Posts

Post

Replies

Boosts

Views

Activity

Time Sensitive Notifications Aren't Working
I am trying to add time sensitive notifications to my task/reminder app, but I am having some difficulty. Here is the code I am using currently: let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent() content.title = "Productivi" // that's the name of the app content.body = "\(taskObject.content)" //task content content.categoryIdentifier = "TASK_REMINDER" if #available(iOS 15,*) { print("Using ios 15 for set notification") content.interruptionLevel = .timeSensitive } For the adding notification request, that part works, however when the notification shows up, it isn't a time sensitive one. (I was testing in simulator and on my phone both running iOS 15.4) I can't figure out what else there is I have to do in order to enable the feature. I've done everything it says to do, is their an entitlement or capability I have to add. If so, what is it called and can some one please give me detailed steps on how to add that for local notifications in XCODE? Thank you, -Rohan
1
0
1.4k
Apr ’22
Time sensitive push only works after reinstall
I was implementing time sensitive (remote) push notifications for my app. Which works when I delete the previous version and install the new version. However, it does not work when updating the app from the older version to the newer one which supports time sensitive notifications. I have enabled Time Sensitive Notifications in the developer console and the entitlement file looks like this <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>aps-environment</key> <string>development</string> <key>com.apple.developer.usernotifications.time-sensitive</key> <true/> </dict> </plist> This is the content of the notification {"aps":{"alert":"Reward", "sound": "default", "interruption-level": "time-sensitive"}, "type": "reward", "rewardText": "Cool dude", "rewardPoints": 200} Anyone got an idea?
2
0
1.4k
Apr ’22
iOS 15 Communication Notifications not working!
Hello, I recently wrote a Notification Service Extension to allow me to specify a "sender-url" and "attachment-url" property with urls from my backend which are then used to display the appropriate icon images in the sent push notification. Below are all the steps I have taken: Created a Notification Service Extension Added the "Push Notifications" and "Communication Notifications" abilities to my main app. Added (Dict) -> "NSUserActivityTypes" (Array) -> "INSendMessageIntent" (String) to my main app's Info.plist. Added the "NSExtensionAttributes" (Dictionary) -> "IntentsSupported" (Array) -> "INSendMessageIntent" (String) to my Notification Service Extension's Info.plist. I have double checked Apple Developer Portal to make sure that my main App has both the "Push Notifications" and "Communication Notifications" Capabilities. My Notification Service Extension works flawlessly for displaying attachment images through the "attachment-url" property but my extension is unable to properly display a Communication Notification with the custom icon. There are no errors thrown in my code and my extension runs flawlessly yet the notification comes through unchanged when attempting to send it as a Communication Notification. I would also like to add that Communication Notifications work perfectly when I send them locally from the app by following this guide: https://gist.github.com/Dexwell/dedef7389eae26c5b9db927dc5588905 so It is clear that the problem is not my code but the fact that the Communication Notification is being initialized through a Service Extension instead of the app itself. The Apple documentation for Communication Notifications is extremely confusing and thus any help regarding this matter would be appreciated. Full Logs
0
0
1.6k
Mar ’22
Multiple avatars to a intent in communication notifications
I was trying to add multiple sender avatars to a group conversation communication notifications but it's not reflecting in UI. Every Sender object has an image property which has an image value but not all images are showing up in the notification avatar. Also, tried to replicate this locally by creating a custom collage and assign it as image but the InImage doesn't take the local images to render and just showing empty avatar. How can we add multiple avatars to communication notifications? And how can we read InImage from local?
1
0
1.2k
Feb ’22
APNS Content Available Push not working in iOS 15
APNS Content available push not received in iOS 15 device when app builds with Xcode 13.0, iOS 15 SDK. Push payload data with content available:1 not working {"aps":{"content-available":1},"update":"2|1"} but normal notification message push working {"aps":{"alert":"welcome"}} is there any payload or configuration in the header field for the iOS 15 silent push message?
2
0
2.4k
Nov ’21
iOS 15 - "Keep..." button in user notifications doesn't save the settings
Hi, When receiving provisional user notifications in iOS 15 the "Turn Off..." button works fine, but the "Keep..." button doesn't save the settings. "Deliver Immediately" option doesn't do anything and "Deliver in Scheduled Summary" hides the buttons, but they appear again in next notification. I've noticed this behavior with several different apps, for example Reddit. Does anyone know anything about this? I have also submitted a bug to Apple but no response so far. select Deliver Immediately can not save , my select , nextTime has new notification , let me select Deliver Immediately or Deliver in Scheduled Summary again . xcode 13.1 iphone 15.1
0
0
895
Nov ’21
How to show group name in the subtitle of the Communication Notification?
Hi all, I am trying to display the name of the group in the subtitle of the communication notification, like this: Here is my code:     override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {         self.contentHandler = contentHandler         var personNameComponents = PersonNameComponents()         personNameComponents.nickname = "Test Person"         let avatar = INImage(url: URL(string: "https:imageURL")!)         let senderPerson = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: personNameComponents, displayName: "Test Person", image: avatar, contactIdentifier: nil, customIdentifier: nil, isMe: false, suggestionType: .none)         let mePerson = INPerson( personHandle: INPersonHandle(value: "1233211232", type: .unknown), nameComponents: nil, displayName: nil, image: nil, contactIdentifier: nil, customIdentifier: nil, isMe: true, suggestionType: .none)         let incomingMessagingIntent = INSendMessageIntent(recipients: [mePerson], outgoingMessageType: .unknown, content: "Test", speakableGroupName: INSpeakableString(spokenPhrase: "Test Group"), conversationIdentifier: "Test Group", serviceName: "Test", sender: senderPerson, attachments: nil)         incomingMessagingIntent.setImage(avatar, forParameterNamed: \.sender)         let interaction = INInteraction(intent: incomingMessagingIntent, response: nil)         interaction.direction = .incoming         do {             let newContent = try request.content.updating(from: incomingMessagingIntent) as! UNMutableNotificationContent             contentHandler(newContent)         } catch {             print(error)         }     } I also have tried: Setting the subtitle of the UNMutableNotificationContent Including the subtitle field in the aps remote notification payload When I display the notification as a normal notification the subtitle is displayed as usual. What am I doing incorrectly?
2
0
2.2k
Oct ’21
How to show in the subtitle of the Communication Notification?
I build APNs but It show me the logs I guess THERE might be some permissions I haven't configured LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 2021-10-15 19:01:24.734879+0800 CodeNotificationExtension[28603:929180] [default] Attempt to map database failed: permission was denied. This attempt will not be retried. 2021-10-15 19:01:24.734947+0800 CodeNotificationExtension[28603:929180] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 2021-10-15 19:01:24.735022+0800 CodeNotificationExtension[28603:929180] [Intents] +[INAppInfo appInfoWithAppProxy:] Unable to create app info with application record: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
1
0
1.6k
Oct ’21
Notification does not show as communication notification
Hi all, I am trying to implement the communication notification for me app. But the avatar does not show and there is virtually no difference from a normal notification. I also added the Communication Notification capability, and in my Notification Service Extension's Info.plist, added this: NSExtension → NSExtensionAttributes (dictionary) → IntentsSupported (array) → INSendMessageIntent (string) What am I doing wrong? Here is my code: class NotificationService: UNNotificationServiceExtension {     var contentHandler: ((UNNotificationContent) -> Void)?     var bestAttemptContent: UNMutableNotificationContent?     override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {                  var personNameComponents = PersonNameComponents()         personNameComponents.nickname = "Sender Name"         let avatar = INImage(named: "Cover")         let senderPerson = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: personNameComponents, displayName: "Sender Name", image: avatar, contactIdentifier: nil, customIdentifier: nil, isMe: false, suggestionType: .none)         let mePerson = INPerson( personHandle: INPersonHandle(value: "1233211232", type: .unknown), nameComponents: nil, displayName: nil, image: nil, contactIdentifier: nil, customIdentifier: nil, isMe: true, suggestionType: .none)         let incomingMessagingIntent = INSendMessageIntent(recipients: [mePerson], outgoingMessageType: .outgoingMessageText, content: "Test DUde", speakableGroupName: nil, conversationIdentifier: "uid", serviceName: "caset", sender: senderPerson, attachments: [])         incomingMessagingIntent.setImage(avatar, forParameterNamed: \.sender)         let interaction = INInteraction(intent: incomingMessagingIntent, response: nil)         interaction.direction = .incoming         do {             let newContent = try request.content.updating(from: incomingMessagingIntent)             contentHandler(newContent)         } catch {             print(error)         }     }     override func serviceExtensionTimeWillExpire() {         // Called just before the extension will be terminated by the system.         // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.         if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {             contentHandler(bestAttemptContent)         }     } }
2
0
1.7k
Oct ’21
Not Seeing iOS 15 Notification Avatars
I work on a Messaging app. I am trying to update our app so that it will donate communication intents whenever a message is received. The problem is, even though I am successfully creating an INSendMessageIntent, with a sender (INPerson) with an associated INImage, iOS 15 never actually shows the sender's avatar/image. Is there something more I need to do? This is basically what my code does: INImage *senderImage = [INImage imageWithImageData:imageData]; INPerson *const contact = [[INPerson alloc]                   initWithPersonHandle:handle                   nameComponents:components                   displayName:context.notification.content.title                   image:senderImage                   contactIdentifier:nil                   customIdentifier:senderId.stringValue]; INSendMessageIntent *intent = [[INSendMessageIntent alloc]                     initWithRecipients:@[recipient]                     outgoingMessageType:INOutgoingMessageTypeUnknown                     content:messageText                     speakableGroupName:nil                     conversationIdentifier:threadId                     serviceName:@"Instagram Direct"                     sender:contact                     attachments:nil]; nseContentHandler([notifContent contentByUpdatingWithProvider:intent error:&error]); I am doing all of this in the Notification Service Extension. I can see that the image is valid/nonnull and the contentByUpdatingWithProvider:error: method does not set an error, so I am quite confused
4
0
2.9k
Oct ’21
interruptionLevel crashes the iOS App on Silicon Macs
I recently added time-sensitive notifications to my iOS / iPadOS App. let content = UNMutableNotificationContent() if #available(iOS 15.0, *) {         content.interruptionLevel = .timeSensitive } The if #available works fine on iOS 15 and it is ignored on iPadOS or older iOS builds, but it's making the (designed for iPad) App crash when running on Apple Silicon Macs. I am getting the following error: Value of type 'UNMutableNotificationContent' has no member 'interruptionLevel' I tried to add another check but it doesn't work either: #if os(iOS)       if #available(iOS 15.0, *) {         content.interruptionLevel = .timeSensitive       } #endif
1
0
871
Oct ’21
Time Sensitive notifications not working
Hello, we have updated our app to include the time sensitive notification entitlement and changed the payload sent to the APNS to include the "interruption-level": "time-sensitive" key. However no notification is able to bypass the Schedule or Focus modes. We've been able to check and the payload is received properly by the app. Is there any known issue? "aps": { "sound": "default", "alert": { "title": "Awesome title" "body": "New Time Sensitive notification received", "action-loc-key": "Details" }, "interruption-level": "time-sensitive", "badge": 6 } Also using the code suggested during the WWDC session doesn't work. let content = UNMutableNotificationContent()         content.title = "Urgent"         content.body = "A time sensitive notification"         if #available(iOS 15.0, *) {             content.interruptionLevel = .timeSensitive         } else {             // Fallback on earlier versions         }         let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)         let request = UNNotificationRequest(identifier: "time-sensitive-example", content: content, trigger: trigger)         notificationCenter.add(request) { Error in                      }
6
0
8.7k
Oct ’21
Relevance Score is ignored when displaying in Notification Summary
Based off the Apple documentation, I expected to see that the notification with the highest relevance score was featured in the Notification Summary. However, when sending several notifications from a single app with the new relevance score field, I am consistently seeing the most recent notification be featured in the Summary — not the one with the highest score. I am using Xcode 13 beta 5 and a device running iOS 15 beta 6. This is the sample payload sent via APNs (with the relevance score being updated between sends): { "aps": { "alert": { "title": "Relevance score: 0.4", "body": "body text here." }, "interruption-level" : "active", "relevance-score" : 0.4 } } I have also confirmed that the UNNotificationContent object has the relevance score field populated with the expected double when receiving the push on the device.
3
0
1.7k
Sep ’21
app crash when using Focus Status Center to request authentication
I didn't add the intentsExtension and intentsUIExtension in my app. I added the communication notifications, time sensitive notifications and push notifications capabilities. I tried to call [FocusStatus.defaultCenter requestAuthorizationWithCompletionHandler:nil]; from my main app. The app would crash when xCode executed the function. Even I provide a completion handler block as input of the function, the app would still crash. (1) should I add two of the Intent extensions in order to use this function? (2) If yes, should I call this ^ function inside these two extensions? and can I call it in the main app? (3) should I call the function asynchronously? Thanks!
1
0
648
Sep ’21
Communication Notification capability intended use
Hi, We're working on a non-communication app that would like to send important (health related) updates through the local notification system (UserNotifications). We're sure that these notifications could fit into the "time sensitive" category due to their health relevance. However, one important feature that we need is querying if the user has focus mode enabled and if we're allowed to break through the current focus mode set by the user. Apple provides the Intent API to check if there's a current focus mode enabled, however, it is bound to the "Communication Notification" capability. This capability have its intended use just for chat/instant messenger apps. We're wondering if we could leverage this capability for our purposes even without fitting into the "Communication" app category.
1
0
1.1k
Sep ’21
Time Sensitive Notifications Aren't Working
I am trying to add time sensitive notifications to my task/reminder app, but I am having some difficulty. Here is the code I am using currently: let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent() content.title = "Productivi" // that's the name of the app content.body = "\(taskObject.content)" //task content content.categoryIdentifier = "TASK_REMINDER" if #available(iOS 15,*) { print("Using ios 15 for set notification") content.interruptionLevel = .timeSensitive } For the adding notification request, that part works, however when the notification shows up, it isn't a time sensitive one. (I was testing in simulator and on my phone both running iOS 15.4) I can't figure out what else there is I have to do in order to enable the feature. I've done everything it says to do, is their an entitlement or capability I have to add. If so, what is it called and can some one please give me detailed steps on how to add that for local notifications in XCODE? Thank you, -Rohan
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’22
Time sensitive push only works after reinstall
I was implementing time sensitive (remote) push notifications for my app. Which works when I delete the previous version and install the new version. However, it does not work when updating the app from the older version to the newer one which supports time sensitive notifications. I have enabled Time Sensitive Notifications in the developer console and the entitlement file looks like this <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>aps-environment</key> <string>development</string> <key>com.apple.developer.usernotifications.time-sensitive</key> <true/> </dict> </plist> This is the content of the notification {"aps":{"alert":"Reward", "sound": "default", "interruption-level": "time-sensitive"}, "type": "reward", "rewardText": "Cool dude", "rewardPoints": 200} Anyone got an idea?
Replies
2
Boosts
0
Views
1.4k
Activity
Apr ’22
iOS 15 Communication Notifications not working!
Hello, I recently wrote a Notification Service Extension to allow me to specify a "sender-url" and "attachment-url" property with urls from my backend which are then used to display the appropriate icon images in the sent push notification. Below are all the steps I have taken: Created a Notification Service Extension Added the "Push Notifications" and "Communication Notifications" abilities to my main app. Added (Dict) -> "NSUserActivityTypes" (Array) -> "INSendMessageIntent" (String) to my main app's Info.plist. Added the "NSExtensionAttributes" (Dictionary) -> "IntentsSupported" (Array) -> "INSendMessageIntent" (String) to my Notification Service Extension's Info.plist. I have double checked Apple Developer Portal to make sure that my main App has both the "Push Notifications" and "Communication Notifications" Capabilities. My Notification Service Extension works flawlessly for displaying attachment images through the "attachment-url" property but my extension is unable to properly display a Communication Notification with the custom icon. There are no errors thrown in my code and my extension runs flawlessly yet the notification comes through unchanged when attempting to send it as a Communication Notification. I would also like to add that Communication Notifications work perfectly when I send them locally from the app by following this guide: https://gist.github.com/Dexwell/dedef7389eae26c5b9db927dc5588905 so It is clear that the problem is not my code but the fact that the Communication Notification is being initialized through a Service Extension instead of the app itself. The Apple documentation for Communication Notifications is extremely confusing and thus any help regarding this matter would be appreciated. Full Logs
Replies
0
Boosts
0
Views
1.6k
Activity
Mar ’22
Multiple avatars to a intent in communication notifications
I was trying to add multiple sender avatars to a group conversation communication notifications but it's not reflecting in UI. Every Sender object has an image property which has an image value but not all images are showing up in the notification avatar. Also, tried to replicate this locally by creating a custom collage and assign it as image but the InImage doesn't take the local images to render and just showing empty avatar. How can we add multiple avatars to communication notifications? And how can we read InImage from local?
Replies
1
Boosts
0
Views
1.2k
Activity
Feb ’22
Get device scheduled focus status
I'd like to be notified when a scheduled focus status is on or off. Have tried many many ways but failed.
Replies
1
Boosts
0
Views
460
Activity
Dec ’21
Where is the Focus Status API
In SOTU, a Focus Status API was announced for communication apps, but I haven't found any session nor documentation about it. Where can I find more information about that new API?
Replies
6
Boosts
0
Views
7.9k
Activity
Dec ’21
APNS Content Available Push not working in iOS 15
APNS Content available push not received in iOS 15 device when app builds with Xcode 13.0, iOS 15 SDK. Push payload data with content available:1 not working {"aps":{"content-available":1},"update":"2|1"} but normal notification message push working {"aps":{"alert":"welcome"}} is there any payload or configuration in the header field for the iOS 15 silent push message?
Replies
2
Boosts
0
Views
2.4k
Activity
Nov ’21
iOS 15 how to get the information of current focus mode?
I want to get information on the focus mode, such as the icon and title of the current focus mode. Are there APIs to do that?
Replies
1
Boosts
0
Views
744
Activity
Nov ’21
iOS 15 - "Keep..." button in user notifications doesn't save the settings
Hi, When receiving provisional user notifications in iOS 15 the "Turn Off..." button works fine, but the "Keep..." button doesn't save the settings. "Deliver Immediately" option doesn't do anything and "Deliver in Scheduled Summary" hides the buttons, but they appear again in next notification. I've noticed this behavior with several different apps, for example Reddit. Does anyone know anything about this? I have also submitted a bug to Apple but no response so far. select Deliver Immediately can not save , my select , nextTime has new notification , let me select Deliver Immediately or Deliver in Scheduled Summary again . xcode 13.1 iphone 15.1
Replies
0
Boosts
0
Views
895
Activity
Nov ’21
How do I enable "Direct Messages" to be sent immediately, instead of to Scheduled Summary?
Instagram appears to be able to do this. Photos attached.
Replies
1
Boosts
0
Views
617
Activity
Oct ’21
How to show group name in the subtitle of the Communication Notification?
Hi all, I am trying to display the name of the group in the subtitle of the communication notification, like this: Here is my code:     override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {         self.contentHandler = contentHandler         var personNameComponents = PersonNameComponents()         personNameComponents.nickname = "Test Person"         let avatar = INImage(url: URL(string: "https:imageURL")!)         let senderPerson = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: personNameComponents, displayName: "Test Person", image: avatar, contactIdentifier: nil, customIdentifier: nil, isMe: false, suggestionType: .none)         let mePerson = INPerson( personHandle: INPersonHandle(value: "1233211232", type: .unknown), nameComponents: nil, displayName: nil, image: nil, contactIdentifier: nil, customIdentifier: nil, isMe: true, suggestionType: .none)         let incomingMessagingIntent = INSendMessageIntent(recipients: [mePerson], outgoingMessageType: .unknown, content: "Test", speakableGroupName: INSpeakableString(spokenPhrase: "Test Group"), conversationIdentifier: "Test Group", serviceName: "Test", sender: senderPerson, attachments: nil)         incomingMessagingIntent.setImage(avatar, forParameterNamed: \.sender)         let interaction = INInteraction(intent: incomingMessagingIntent, response: nil)         interaction.direction = .incoming         do {             let newContent = try request.content.updating(from: incomingMessagingIntent) as! UNMutableNotificationContent             contentHandler(newContent)         } catch {             print(error)         }     } I also have tried: Setting the subtitle of the UNMutableNotificationContent Including the subtitle field in the aps remote notification payload When I display the notification as a normal notification the subtitle is displayed as usual. What am I doing incorrectly?
Replies
2
Boosts
0
Views
2.2k
Activity
Oct ’21
How to show in the subtitle of the Communication Notification?
I build APNs but It show me the logs I guess THERE might be some permissions I haven't configured LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 2021-10-15 19:01:24.734879+0800 CodeNotificationExtension[28603:929180] [default] Attempt to map database failed: permission was denied. This attempt will not be retried. 2021-10-15 19:01:24.734947+0800 CodeNotificationExtension[28603:929180] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 2021-10-15 19:01:24.735022+0800 CodeNotificationExtension[28603:929180] [Intents] +[INAppInfo appInfoWithAppProxy:] Unable to create app info with application record: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
Replies
1
Boosts
0
Views
1.6k
Activity
Oct ’21
How do I get the status of the Scheduled Summary switch and Show Next Summary switch.
How do I get the status of the Scheduled Summary switch and Show Next Summary switch.
Replies
0
Boosts
0
Views
607
Activity
Oct ’21
Notification does not show as communication notification
Hi all, I am trying to implement the communication notification for me app. But the avatar does not show and there is virtually no difference from a normal notification. I also added the Communication Notification capability, and in my Notification Service Extension's Info.plist, added this: NSExtension → NSExtensionAttributes (dictionary) → IntentsSupported (array) → INSendMessageIntent (string) What am I doing wrong? Here is my code: class NotificationService: UNNotificationServiceExtension {     var contentHandler: ((UNNotificationContent) -> Void)?     var bestAttemptContent: UNMutableNotificationContent?     override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {                  var personNameComponents = PersonNameComponents()         personNameComponents.nickname = "Sender Name"         let avatar = INImage(named: "Cover")         let senderPerson = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: personNameComponents, displayName: "Sender Name", image: avatar, contactIdentifier: nil, customIdentifier: nil, isMe: false, suggestionType: .none)         let mePerson = INPerson( personHandle: INPersonHandle(value: "1233211232", type: .unknown), nameComponents: nil, displayName: nil, image: nil, contactIdentifier: nil, customIdentifier: nil, isMe: true, suggestionType: .none)         let incomingMessagingIntent = INSendMessageIntent(recipients: [mePerson], outgoingMessageType: .outgoingMessageText, content: "Test DUde", speakableGroupName: nil, conversationIdentifier: "uid", serviceName: "caset", sender: senderPerson, attachments: [])         incomingMessagingIntent.setImage(avatar, forParameterNamed: \.sender)         let interaction = INInteraction(intent: incomingMessagingIntent, response: nil)         interaction.direction = .incoming         do {             let newContent = try request.content.updating(from: incomingMessagingIntent)             contentHandler(newContent)         } catch {             print(error)         }     }     override func serviceExtensionTimeWillExpire() {         // Called just before the extension will be terminated by the system.         // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.         if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {             contentHandler(bestAttemptContent)         }     } }
Replies
2
Boosts
0
Views
1.7k
Activity
Oct ’21
Not Seeing iOS 15 Notification Avatars
I work on a Messaging app. I am trying to update our app so that it will donate communication intents whenever a message is received. The problem is, even though I am successfully creating an INSendMessageIntent, with a sender (INPerson) with an associated INImage, iOS 15 never actually shows the sender's avatar/image. Is there something more I need to do? This is basically what my code does: INImage *senderImage = [INImage imageWithImageData:imageData]; INPerson *const contact = [[INPerson alloc]                   initWithPersonHandle:handle                   nameComponents:components                   displayName:context.notification.content.title                   image:senderImage                   contactIdentifier:nil                   customIdentifier:senderId.stringValue]; INSendMessageIntent *intent = [[INSendMessageIntent alloc]                     initWithRecipients:@[recipient]                     outgoingMessageType:INOutgoingMessageTypeUnknown                     content:messageText                     speakableGroupName:nil                     conversationIdentifier:threadId                     serviceName:@"Instagram Direct"                     sender:contact                     attachments:nil]; nseContentHandler([notifContent contentByUpdatingWithProvider:intent error:&error]); I am doing all of this in the Notification Service Extension. I can see that the image is valid/nonnull and the contentByUpdatingWithProvider:error: method does not set an error, so I am quite confused
Replies
4
Boosts
0
Views
2.9k
Activity
Oct ’21
interruptionLevel crashes the iOS App on Silicon Macs
I recently added time-sensitive notifications to my iOS / iPadOS App. let content = UNMutableNotificationContent() if #available(iOS 15.0, *) {         content.interruptionLevel = .timeSensitive } The if #available works fine on iOS 15 and it is ignored on iPadOS or older iOS builds, but it's making the (designed for iPad) App crash when running on Apple Silicon Macs. I am getting the following error: Value of type 'UNMutableNotificationContent' has no member 'interruptionLevel' I tried to add another check but it doesn't work either: #if os(iOS)       if #available(iOS 15.0, *) {         content.interruptionLevel = .timeSensitive       } #endif
Replies
1
Boosts
0
Views
871
Activity
Oct ’21
Time Sensitive notifications not working
Hello, we have updated our app to include the time sensitive notification entitlement and changed the payload sent to the APNS to include the "interruption-level": "time-sensitive" key. However no notification is able to bypass the Schedule or Focus modes. We've been able to check and the payload is received properly by the app. Is there any known issue? "aps": { "sound": "default", "alert": { "title": "Awesome title" "body": "New Time Sensitive notification received", "action-loc-key": "Details" }, "interruption-level": "time-sensitive", "badge": 6 } Also using the code suggested during the WWDC session doesn't work. let content = UNMutableNotificationContent()         content.title = "Urgent"         content.body = "A time sensitive notification"         if #available(iOS 15.0, *) {             content.interruptionLevel = .timeSensitive         } else {             // Fallback on earlier versions         }         let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)         let request = UNNotificationRequest(identifier: "time-sensitive-example", content: content, trigger: trigger)         notificationCenter.add(request) { Error in                      }
Replies
6
Boosts
0
Views
8.7k
Activity
Oct ’21
Relevance Score is ignored when displaying in Notification Summary
Based off the Apple documentation, I expected to see that the notification with the highest relevance score was featured in the Notification Summary. However, when sending several notifications from a single app with the new relevance score field, I am consistently seeing the most recent notification be featured in the Summary — not the one with the highest score. I am using Xcode 13 beta 5 and a device running iOS 15 beta 6. This is the sample payload sent via APNs (with the relevance score being updated between sends): { "aps": { "alert": { "title": "Relevance score: 0.4", "body": "body text here." }, "interruption-level" : "active", "relevance-score" : 0.4 } } I have also confirmed that the UNNotificationContent object has the relevance score field populated with the expected double when receiving the push on the device.
Replies
3
Boosts
0
Views
1.7k
Activity
Sep ’21
app crash when using Focus Status Center to request authentication
I didn't add the intentsExtension and intentsUIExtension in my app. I added the communication notifications, time sensitive notifications and push notifications capabilities. I tried to call [FocusStatus.defaultCenter requestAuthorizationWithCompletionHandler:nil]; from my main app. The app would crash when xCode executed the function. Even I provide a completion handler block as input of the function, the app would still crash. (1) should I add two of the Intent extensions in order to use this function? (2) If yes, should I call this ^ function inside these two extensions? and can I call it in the main app? (3) should I call the function asynchronously? Thanks!
Replies
1
Boosts
0
Views
648
Activity
Sep ’21
Communication Notification capability intended use
Hi, We're working on a non-communication app that would like to send important (health related) updates through the local notification system (UserNotifications). We're sure that these notifications could fit into the "time sensitive" category due to their health relevance. However, one important feature that we need is querying if the user has focus mode enabled and if we're allowed to break through the current focus mode set by the user. Apple provides the Intent API to check if there's a current focus mode enabled, however, it is bound to the "Communication Notification" capability. This capability have its intended use just for chat/instant messenger apps. We're wondering if we could leverage this capability for our purposes even without fitting into the "Communication" app category.
Replies
1
Boosts
0
Views
1.1k
Activity
Sep ’21