iOS other apps display their own APP when "open in other apps"

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
Insert image description here

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.plistthe second is to add one by one directly in the , the effect is the sameSource Code
Insert image description here
info - > Document Type

Insert image description here

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 

Guess you like

Origin blog.csdn.net/SSY_1992/article/details/132505169