I am trying to address an issue with my app’s share sheet where, when the user sends a URL to either Apple Reminders or OmniFocus, the receiving app does not get a title. So I am updating my share sheet code to use UIActivityItemsConfiguration.
I have this code:
let title = "Golden Hill Software"
let url = URL(string: "https://www.goldenhillsoftware.com/")!
let itemProvider = NSItemProvider()
itemProvider.registerObject(ofClass: URL.self, visibility: .all) { (handler) in
handler(url, nil)
return nil
}
let config = UIActivityItemsConfiguration(itemProviders: [itemProvider])
config.metadataProvider = { (key) in
if key == .title || key == .messageBody {
return title
} else {
return nil
}
}
let viewController = UIActivityViewController(activityItemsConfiguration: config)
self.present(viewController, animated: true)
This works with some share sheet extensions. But when I choose the Ivory share extension, Ivory creates a post with a URL that starts with bplist…. When I choose the Open in Chrome action extension, Chrome says “Chrome cannot handle this link”.
Can someone help me understand what I am doing wrong here? (edited)