I’ve an iOS app with in-app options that permit the person choose photographs from their albums or take photographs with the digicam. I might wish to additionally enable customers to import photographs that they discover wherever else on their cellphone: Mail, Safari, Pictures…any app that lets customers long-press a picture and see the “Share…” menu.
I have been wrestling with this for about two weeks. I imagine I am following the documentation completely, however thus far, the solely place I can get my app to seem is when a person is sharing precisely one photograph from the Pictures app. It does not present up if a number of photographs are chosen in Pictures, nor does it present up for photographs in Safari or Mail.
Now, I do know that is doable, as a result of dozens of different third-party apps seem within the Share sheet for any of these sorts of photographs (on my gadget: Instagram, OmniFocus, Instapaper, Obsidian, ChatGPT, to call only a few).
And these should not Share Sheet extensions both – virtually all of those will open the vacation spot app in full and change the main target away from the supply app.
The principle major supply I’ve to go on is that this Apple TechNote (“How do I get my utility to point out up within the Open in… menu.”). I began a recent Xcode venture, made the adjustments urged on this doc and….simply as with my precise app, the one place I see this icon is for single photographs within the Pictures.app.
I’ve tried completely different permutations of LSHandlerRank
, and CFBundleTypeRole
; I’ve tried with and with out CFBundleTypeIconFiles
; with and with out LSSupportsOpeningDocumentsInPlace
; I’ve gone from basic UTI’s like public.information
and public.content material
to intermediate ones like public.picture
and particular ones like public.jpeg
. None works for me. I attempted opening a code-level case with Apple Developer Assist, however am nonetheless awaiting a solution. (I am utilizing these catch-all UTI’s as a result of different purposes which have this working appear to seem in each Share sheet, in every single place on the device_
I did see my app icon seem one time within the Share sheet, however once I tried once more, it did not occur. It looks as if my CFBundleDocumentTypes
get cached by the working system and unpredictably refreshed. I wasn’t capable of get again to the state that precipitated it.
What on earth am I doing fallacious right here? I’ve included quite simple directions on what I am doing with a recent venture and would admire any concrete recommendation anybody may give me.
Under are the steps I adopted to get my non-working CFBundleDocumentTypes
config from a recent Xcode venture. Observe that I’ve already tried a number of completely different mixtures, so please do not simply recommend random new mixtures for me to strive – what I might like to listen to is a config that really works, because it appears to be trivial for all of those different apps to implement.
- Create a brand new Xcode venture.
- Add the next to Data.plist:
CFBundleDocumentTypes
CFBundleTypeName
Picture
LSHandlerRank
Proprietor
CFBundleTypeRole
Editor
LSItemContentTypes
public.information
public.content material
public.merchandise
LSSupportsOpeningDocumentsInPlace
- Although I do not assume this could have an effect on iOS’s skill to search out the bundle’s doc sorts, add this to your auto-generated
SceneDelegate
for good measure:
func scene(_ scene: UIScene, openURLContexts URLContexts: Set) {
for context in URLContexts {
let url = context.url
if let information = strive? Information(contentsOf: url),
let picture = UIImage(information: information) {
let alert = UIAlertController()
alert.title = "Loaded a picture"
alert.message = "Dimension is (picture.measurement)"
window?.rootViewController?.current(alert, animated: true, completion: nil)
}
}
}
NOTES: You possibly can strive with or with out LSSupportsOpeningDocumentsInPlace
– it hasn’t made a distinction for me.