The requirements are as follows: open the file in other APPs, choose other more ways to open it, and then be able to see your own APP
1. Add: to the project’s info.plist file:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>xlsx</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.content</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>xls</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.content</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>pdf</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.content</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>docx</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.content</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>doc</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.content</string>
</array>
</dict>
</array>
There are two ways to add, one is to add in info.plist
the second is to add one by one directly in the , the effect is the sameSource Code
info - > Document Type
After adding it, you can see your own app by checking it in other apps. After the file is transferred, it is received in AppDelegate:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options