iOS APP中第三方APP调用自己的APP,打开文件
2017-09-12 17:43
627 查看
根据需求需要在项目中要打开word、pdf、excel等文件,在info.plist文件中添加
其中,CFBundleTypeExtensions是文件类型,比如:pdf,doc,xls等,不可乱填,
CFBundleTypeIconFiles 是显示在活动列项中的图标,一般用的是app的icon,
Document Content Type UTIs 指定官方指定的文件类型,UTIs即Uniform Type Identifiers。具体可找
<key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string></string> <key>LSItemContentTypes</key> <array> <string>com.microsoft.powerpoint.ppt</string> <string>public.item</string> <string>com.microsoft.word.doc</string> <string>com.adobe.pdf</string> <string>com.microsoft.excel.xls</string> <string>public.image</string> <string>public.content</string> <string>public.composite-content</string> <string>public.archive</string> <string>public.audio</string> <string>public.movie</string> <string>public.text</string> <string>public.data</string> </array> </dict> </array>
其中,CFBundleTypeExtensions是文件类型,比如:pdf,doc,xls等,不可乱填,
CFBundleTypeIconFiles 是显示在活动列项中的图标,一般用的是app的icon,
Document Content Type UTIs 指定官方指定的文件类型,UTIs即Uniform Type Identifiers。具体可找
System-Declared Uniform Type Identifiers
第三方应用打开文件会调用下面的代理方法/** 打开文件调用的代理方发 @param application 自己的app @param url 第三方应用调用时文件的沙盒地址 @param sourceApplication 调用我们APP的第三方应用是谁 @param annotation @return 返回值是YES */ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation { if (self.window) { if (url) { NSString *fileNameStr = [url lastPathComponent]; NSString *Doc = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/localFile"] stringByAppendingPathComponent:fileNameStr]; NSData *data = [NSData dataWithContentsOfURL:url]; [data writeToFile:Doc atomically:YES]; NSLog(@"文件已存到本地文件夹内"); } } return YES; }
ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件
相关文章推荐
- ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件 - 哈哈的笑 - 博客园
- ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件
- ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件
- ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件
- iOS开发笔记--调用打开AppStore显示自己的App
- 第三方APP 调用自己的APP,传输文件
- iOS App让自己的应用在其他应用中打开列表中显示、iOS把自己的应用添加到”活动“、将PDF文件Open In MyApp
- iOS App让自己的应用在其他应用中打开列表中显示、iOS把自己的应用添加到”活动“、将PDF文件Open In MyApp
- iOS开发笔记--调用打开AppStore显示自己的App
- 调用已经安装的APP来打开自己应用中的文件
- iOS 里面如何使用第三方应用程序打开自己的文件,调用wps其他应用打开当前应用里面的的ppt doc xls
- iOS 第三方应用中打开自己的文件(UIDocumentInteractionController)
- ios中通过UIDocumentInteractionControllers调用第三方应用打开本地压缩文件
- iOS 浏览器调用自己的app 自定义URL Scheme
- [ios] 如何调用其他app h5界面调用打开app
- iOS app 打开第三方接口、拨打电话、打开地图第三方app等
- iOS实现APP调用打电话,发短信,发邮件,打开Safari
- iOS让自己的App在其他应用中打开列表中显示
- iOS用第三方应用打开文件