Post

Replies

Boosts

Views

Activity

How to create an `UNNotificationAttachment` with an Image that uses UNNotificationAttachmentOptionsThumbnailClippingRectKey to select only a portion of the image?
The code compiles, however it shows the image just like without options: let options: [AnyHashable: Any] = [ UNNotificationAttachmentOptionsThumbnailClippingRectKey: CGRect( origin: CGPoint(x: 0.1, y: 0.1), size: CGSize(width: 0.1, height: 0.1) ) ] let attachment = try? UNNotificationAttachment( identifier: image.url, url: fileUrl, options: options ) The documentation says I should use CGRectCreateDictionaryRepresentation but it is not available. Cannot find 'CGRectCreateDictionaryRepresentation' in scope Am I missing something?
0
0
241
Oct ’23
Is INSendMessageIntent only for Message related notificaions?
In this screenshot, instead of the app logo only, there is a image of the person that messaged the user. I think this is possible by using an INSendMessageIntent with an INPerson. Apple Wallet notifications however, use a similar design. So should/can we use the INSendMessageIntent with an INPerson for non Message/Person related content? Or is there another way to achieve Apple-Wallets notification style?
0
0
288
Oct ’23
How to clean up UNNotificationAttachments?
I use a UNNotificationServiceExtension to download an image into temporaryDirectory that is attached as an UNNotificationAttachment to the notification. FileManager.default.temporaryDirectory .appendingPathComponent(UUID(). .appendingPathExtension(image.ext) data.write(to: fileUrl) let attachment = ... attachments.append(attachment) The documentation for UNNotificationAttachment say I am responsible to manage the storage space for such attachments: The system limits the amount of storage space allocated for attachments for each app. To delete attachments, use the methods of the UNUserNotificationCenter class to remove the notification requests that contain those attachments. https://developer.apple.com/documentation/usernotifications/unnotificationattachment Do I need to check in my AppDelegate if there are any notifications that are no longer displayed and remove their files? If so, how how to get a list of notifications that are no longer displayed?
0
0
371
Oct ’23
'Foundation/NSURLHandle.h' file not found
When I build my app for my real device I get this error /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURL.h:10:9 'Foundation/NSURLHandle.h' file not found I have latest macOS (13.5.2 (22G91)) and the latest Xcode (14.3.1 (14E300c)). I got this issue about 5 months now, even on my old Intel mac. My new M1 mac was not restored by a Backup and I still get this issue. Can someone please give me a hint or advice to get this issue fixed?
2
0
537
Sep ’23