iOS_44_导入第3方APP内的文件_UTI

Uniform Type Identifier(UTI)

将第3方APP中的文件,使用自家app打开查看


实质是:将第3方的app中的文件  复制到了 自家app的doc/Inbox文件夹内




在info.plist加入

<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeIconFiles</key>
			<array>
				<string>icon_22x29</string>
				<string>icon_44x58</string>
				<string>icon_64x64</string>
				<string>icon_320x320</string>
			</array>
			<key>CFBundleTypeName</key>
			<string>allFiles</string>
			<key>LSHandlerRank</key>
			<string>Owner</string>
			<key>LSItemContentTypes</key>
			<array>
				<string>public.data</string>
			</array>
		</dict>
	</array>

public.data代表 自家app可以打开处理任意文件









四张不同格式的png图片 不知道用到没有




附:

apple官方info.plist中各字段含义

https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-101685





- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

{

/*外部文件访问本应用,会传递参数过来*/ 

    NSLog(@"application = %@",application);

    NSLog(@"url = %@",url);

    NSLog(@"sourceApplication = %@",sourceApplication);

    NSLog(@"annotation = %@",annotation);

}

打印结果:

// 在自家app的doc的Inbox目录中的文件路径

url = file://localhost/private/var/mobile/Applications/10A7BAB7-A437-4DE5-8A67-342AD74956EC/Documents/Inbox/1.jpeg













  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值