Issue:
File Sharing: ‘Open in App’ option is not available for file importing for iOS 16 and Above when Shared extension is added as a target in Xcode.
Description:
My iOS app used to import say abc.xyz file using ‘Open in App’ option which is achieved using Uniform Type Identifiers(UTI). This abc.xyz file is present locally in my iOS device.
Steps to Reproduce:
- Save your custom document in iPhone local storage (let's say extension type is .xyz)
- Then Long Press this attachment.
- Tap on share option.
- This will open the list of Apps that can handle the sharing.
- Long press the app(my iOS app).
- Share sheet is showing only "Share with App" option. "Open in App" option is not available.
[Note: My app also has Share extension to import other file type]
Until iOS 15, When I try to import this file to my app I can see 2 options(Expected behaviour):
- Open in app
- Share with app
But from iOS 16 and above(latest iOS 17 beta 4), I can only see below option,
- Share with app
But my iOS app is expecting “Open in app” option also. Currently this option is not available. So, I am not able to share this file to my app.
To debug further, I created a project and added UTI support to import say abc.pdf file. On iOS 15 and below When this file is attached in email client or available in local storage and try to import to app, I am able to import using "open in App" option. Add Share extension(Which is the requirement of my app), and still I am able to import using the same "open in App" option.
On iOS 16 and above When this file is attached in email client or available in local storage and try to import to app, I can see below option and not able to import the file.
- Copy to app [Observation: If this file is saved locally and try to import from Files app, then I can see “Open in app” option]
But the moment I add Share extension(Which is the requirement of my app), the only option to import file is Share with App.
Summary:
The moment Share extension target is added in project, the only option available is “Share with app” and I am not able to import the file in my app using "open in App" option.
Info.Plist:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.archive</string>
</array>
<key>UTTypeDescription</key>
<string>ImportPDF</string>
<key>UTTypeIdentifier</key>
<string>net.abcd.pdf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>pdf</string>
<string>PDF</string>
</array>
</dict>
</dict>
</array>