ios - 如何在 IOS 中使用应用程序打开下载的文件?

标签 ios ios7 ios5

我正在开发一个应用程序,我在其中下载了各种格式的数据,例如(.pdf、.txt、.mp3 等)我已经使用了代码

NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,recFilName]; [nsdataFromBase64String writeToFile:filePath atomically:YES];

我使用上面的代码成功下载,现在我必须使用支持该扩展的适当应用程序打开下载的文件,任何人都可以帮助我使用代码。

最佳答案

您需要创建一个 UIDocumentPickerViewController 的实例并实现它的委托(delegate)方法。

UIDocumentMenuViewController *documentPicker =
[[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[<items>,...]
            inMode:UIDocumentPickerModeOpen];
documentPicker.delegate = self;
[self presentViewController:documentPicker animated:YES completion:nil];

关于ios - 如何在 IOS 中使用应用程序打开下载的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36545687/

相关文章:

ios - 快速重复检查和操作

ios - 从 Xcode 6 重新构建应用程序时出现 OSStatus 错误 2003334207

ios - Xcode 5 iOS 5 - 既不支持设备也不支持模拟器?

iphone - iPhone 中 textfieldshouldendediting 和 textfieldDidendediting 之间的区别

objective-c - cocos2d - CCDirector,replaceScene 函数问题

ios - 访问数组和字典的防御措施

ios - 用侧曲线 UIBezierPath 画一条对角线

objective-c - Interface Builder 生成的 NSIBPrototypingLayoutConstraint 自动布局约束的 iOS7 问题

ios - 在 iOS 应用程序中创建、读取和写入纯文本文件

iOS 7 色调颜色去饱和度通知