Post

Replies

Boosts

Views

Activity

How to achieve the UIEditMenuInteraction (?) for Link Preview used in iOS 27 Messages
I've been using the iOS 27 beta and noticed in Messages app that the link presentation is now customisable. Upon tapping on the link it opens (what I assume is) an edit menu interaction, which allows customising which metadata is shown. I've seen some links offer more customisation than others, presumably based on available metadata. There's also an option in the menu to convert to a text link, and when highlighting a link in text there's an option to "show link preview" which converts it to an LPLinkView. I've been wondering for a while now if it was possible to add a similar feature to my own app, allowing the user more control over the link previews. How can I achieve similar? Especially "Customise Link" sheet seen in the middle two screenshots?
0
0
445
3d
Bug (?) in Share Extension activation with max count
I have been implementing a share extension for my app and have added the activation rule NSExtensionActivationSupportsImageWithMaxCount. While testing I've noticed that my app will appear in the Share Sheet as a viable target when the max count is exceeded by up to 2 additional photos. For example if I set max to 4 then my app will appear in the share sheet when the user is sharing 1-6 images. On its own this wouldn't be too problematic, I figured I could put some validation in the extension that specifies the user has exceeded the allowed number. But while debugging the extension under this scenario I noticed that the inputItems array on the NSExtensionContext will only contain the number of items I've defined as the max, and silently drop the extra items. I'm sure users will see this as a bug with my app "losing" the extra images since the OS/Share Sheet provides my app as a valid target. My entire Info.plist <?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>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> <integer>1</integer> <key>NSExtensionActivationSupportsImageWithMaxCount</key> <integer>4</integer> </dict> </dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.share-services</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).ShareViewController</string> </dict> </plist> Entire code implementation of the extension class ShareViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() if let extensionContext { debugPrint(extensionContext) } } } Edit: I've been testing on iOS 26.5 with a minimum deployment of iOS 26.0
0
0
240
2w
Can I declare my Share Extension can activate with an infinite number of images?
I am writing a share extension for my app so users can share images from other apps. I have added the NSExtensionActivationSupportsImageWithMaxCount key to the NSExtensionActivationRule dictionary but I am wondering if there is a way to define the activation rule to say I will accept any number of images, and not have it constrained by a maximum value. Looking at the documentation I've noticed that attachments seem to be the only option that defines a minimum count (NSExtensionActivationSupportsAttachmentsWithMinCount). Is there an undocumented equivalent for images or some particular combination to use? I know I could set the max to be some very high number like 999, but I'm just wondering if there is an "official" supported way to achieve a min count defined on the extensions rules.
0
0
248
2w
Can LPLinkMetadata be accessed from NSExtensionContext for my share extension
In the WWDC19 session "Embedding and Sharing Visually Rich Links" it mentions how the Messages app is able to gain access to the LPLinkMetadata provided to the Share Sheet (direct time link) so that it does not have to load the metadata itself. Looking through the NSExtensionContext's inputItems in my share extension and I could not see anything obvious that would allow my own share extension to read the loaded metadata. Am I missing something or is the metadata not made available? To be clear, I am aware of how to use LPMetadataProvider to fetch the metadata. I just want to know if my share extension can make use of the metadata that the Share Sheet has already loaded.
0
0
275
2w
Unable to run App Refresh BackgroundTasks Task, even in Apple Sample Code app
I am attempting to implement App Refresh with the Background Tasks framework - https://developer.apple.com/documentation/backgroundtasks and I cannot get the app to wake. Obviously I can get it to wake with debug functions - https://developer.apple.com/documentation/backgroundtasks/starting_and_terminating_tasks_during_development, but I cannot seem to have the app refresh occur normally. At first I assumed I was doing something wrong, so I went and downloaded the Refreshing and Maintaining Your App Using Background Tasks - https://developer.apple.com/documentation/backgroundtasks/refreshing_and_maintaining_your_app_using_background_tasks sample code. I edited it to OSLog every step of the way and ran that on two separate devices for over a day. One device is a test device for work, the other is my daily driver. Upon inspecting the logs I'm not seeing any of my log messages indicating executions of the App Refresh Tasks, on either device. Searching the logs with "com.example.apple-samplecode" provides a bunch of messages from dasd. It looks like when the app has first been loaded onto the phone it came up with a "Final Decision" of "Can Proceed" but then was immediately followed up with plain com.apple.duetactivityscheduler default 2021-02-16 10:48:29.767009 +1100 dasd scoring 'bgRefresh-com.example.apple-samplecode.ColorFeed.refresh:5EE83C' CurrentScore: 0.617755, ThresholdScore: 0.772525 DecisionToRun:0 Which seems like something made it decide it shouldn't run (based on "DecisionToRun:0"). Subsequent messages from dasd the decision always becomes "Must Not Proceed", with the vast majority of logs appearing like so plain com.apple.duetactivityscheduler default 2021-02-16 10:58:25.975816 +1100 dasd scoring bgRefresh-com.example.apple-samplecode.ColorFeed.refresh:5EE83C:[ {name: ApplicationPolicy, policyWeight: 50.000, response: {Decision: Must Not Proceed, Score: 0.00}}  ], FinalDecision: Must Not Proceed} Occasionally there'll be extra policies, but vast majority of the time it's just the ApplicationPolicy. There seems to be one of those log entries, from dasd, quite frequently with the most frequent being mere tens of milliseconds, all the way up to 4 minutes; though the most common time between evaluation does appear to be ~30 seconds. With nearing an additional day of running the app on both devices I am seeing within about a 3 hour window another dozen "Can Proceed" messages immediately followed by "DecisionToRun:0", but there haven't been any more for the last 10 or so hours. Obviously also none of my log messages are there either. Is there something, obvious or otherwise, that am I doing wrong here?
2
1
1.9k
Aug ’21
How to achieve the UIEditMenuInteraction (?) for Link Preview used in iOS 27 Messages
I've been using the iOS 27 beta and noticed in Messages app that the link presentation is now customisable. Upon tapping on the link it opens (what I assume is) an edit menu interaction, which allows customising which metadata is shown. I've seen some links offer more customisation than others, presumably based on available metadata. There's also an option in the menu to convert to a text link, and when highlighting a link in text there's an option to "show link preview" which converts it to an LPLinkView. I've been wondering for a while now if it was possible to add a similar feature to my own app, allowing the user more control over the link previews. How can I achieve similar? Especially "Customise Link" sheet seen in the middle two screenshots?
Replies
0
Boosts
0
Views
445
Activity
3d
Bug (?) in Share Extension activation with max count
I have been implementing a share extension for my app and have added the activation rule NSExtensionActivationSupportsImageWithMaxCount. While testing I've noticed that my app will appear in the Share Sheet as a viable target when the max count is exceeded by up to 2 additional photos. For example if I set max to 4 then my app will appear in the share sheet when the user is sharing 1-6 images. On its own this wouldn't be too problematic, I figured I could put some validation in the extension that specifies the user has exceeded the allowed number. But while debugging the extension under this scenario I noticed that the inputItems array on the NSExtensionContext will only contain the number of items I've defined as the max, and silently drop the extra items. I'm sure users will see this as a bug with my app "losing" the extra images since the OS/Share Sheet provides my app as a valid target. My entire Info.plist <?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>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> <integer>1</integer> <key>NSExtensionActivationSupportsImageWithMaxCount</key> <integer>4</integer> </dict> </dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.share-services</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).ShareViewController</string> </dict> </plist> Entire code implementation of the extension class ShareViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() if let extensionContext { debugPrint(extensionContext) } } } Edit: I've been testing on iOS 26.5 with a minimum deployment of iOS 26.0
Replies
0
Boosts
0
Views
240
Activity
2w
Can I declare my Share Extension can activate with an infinite number of images?
I am writing a share extension for my app so users can share images from other apps. I have added the NSExtensionActivationSupportsImageWithMaxCount key to the NSExtensionActivationRule dictionary but I am wondering if there is a way to define the activation rule to say I will accept any number of images, and not have it constrained by a maximum value. Looking at the documentation I've noticed that attachments seem to be the only option that defines a minimum count (NSExtensionActivationSupportsAttachmentsWithMinCount). Is there an undocumented equivalent for images or some particular combination to use? I know I could set the max to be some very high number like 999, but I'm just wondering if there is an "official" supported way to achieve a min count defined on the extensions rules.
Replies
0
Boosts
0
Views
248
Activity
2w
Can LPLinkMetadata be accessed from NSExtensionContext for my share extension
In the WWDC19 session "Embedding and Sharing Visually Rich Links" it mentions how the Messages app is able to gain access to the LPLinkMetadata provided to the Share Sheet (direct time link) so that it does not have to load the metadata itself. Looking through the NSExtensionContext's inputItems in my share extension and I could not see anything obvious that would allow my own share extension to read the loaded metadata. Am I missing something or is the metadata not made available? To be clear, I am aware of how to use LPMetadataProvider to fetch the metadata. I just want to know if my share extension can make use of the metadata that the Share Sheet has already loaded.
Replies
0
Boosts
0
Views
275
Activity
2w
Unable to run App Refresh BackgroundTasks Task, even in Apple Sample Code app
I am attempting to implement App Refresh with the Background Tasks framework - https://developer.apple.com/documentation/backgroundtasks and I cannot get the app to wake. Obviously I can get it to wake with debug functions - https://developer.apple.com/documentation/backgroundtasks/starting_and_terminating_tasks_during_development, but I cannot seem to have the app refresh occur normally. At first I assumed I was doing something wrong, so I went and downloaded the Refreshing and Maintaining Your App Using Background Tasks - https://developer.apple.com/documentation/backgroundtasks/refreshing_and_maintaining_your_app_using_background_tasks sample code. I edited it to OSLog every step of the way and ran that on two separate devices for over a day. One device is a test device for work, the other is my daily driver. Upon inspecting the logs I'm not seeing any of my log messages indicating executions of the App Refresh Tasks, on either device. Searching the logs with "com.example.apple-samplecode" provides a bunch of messages from dasd. It looks like when the app has first been loaded onto the phone it came up with a "Final Decision" of "Can Proceed" but then was immediately followed up with plain com.apple.duetactivityscheduler default 2021-02-16 10:48:29.767009 +1100 dasd scoring 'bgRefresh-com.example.apple-samplecode.ColorFeed.refresh:5EE83C' CurrentScore: 0.617755, ThresholdScore: 0.772525 DecisionToRun:0 Which seems like something made it decide it shouldn't run (based on "DecisionToRun:0"). Subsequent messages from dasd the decision always becomes "Must Not Proceed", with the vast majority of logs appearing like so plain com.apple.duetactivityscheduler default 2021-02-16 10:58:25.975816 +1100 dasd scoring bgRefresh-com.example.apple-samplecode.ColorFeed.refresh:5EE83C:[ {name: ApplicationPolicy, policyWeight: 50.000, response: {Decision: Must Not Proceed, Score: 0.00}}  ], FinalDecision: Must Not Proceed} Occasionally there'll be extra policies, but vast majority of the time it's just the ApplicationPolicy. There seems to be one of those log entries, from dasd, quite frequently with the most frequent being mere tens of milliseconds, all the way up to 4 minutes; though the most common time between evaluation does appear to be ~30 seconds. With nearing an additional day of running the app on both devices I am seeing within about a 3 hour window another dozen "Can Proceed" messages immediately followed by "DecisionToRun:0", but there haven't been any more for the last 10 or so hours. Obviously also none of my log messages are there either. Is there something, obvious or otherwise, that am I doing wrong here?
Replies
2
Boosts
1
Views
1.9k
Activity
Aug ’21