jjzjj

ios - UIDocumentInteractionController 在没有选项的特定应用程序中打开文件

coder 2023-09-23 原文

我正在使用 UIDocumentInteractionController 在另一个应用程序 DropBox 中打开文件。

我想做的是在另一个特定的应用程序中打开文件,但到目前为止我只设法显示支持的应用程序并允许用户选择。

UIDocumentInteractionController *udi = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath: jpgPath]];
[udi retain];
CGRect r = CGRectMake(0, 0, 300, 300);
[udi presentOpenInMenuFromRect:r inView:self.view animated:YES];

这提供了支持的应用程序列表,但我想直接使用保管箱打开文件,而不是选项框。有什么想法吗?

最佳答案

我很乐意被反驳,但我认为这是不可能的(至少在 iOS 4 之前并包括在内)。

在另一个应用程序中打开文件的正常方法是使用自定义 URL 方案。 (请参阅 openURL 的文档:在 UIApplication 类引用中以及在 iOS 应用程序编程指南中的 Implementing Custom URL Schemes。)据我所知,Dropbox 尚未实现自定义 URL 方案。而且,鉴于此,这种方法是封闭的。

UIDocumentationController 非常不透明。你可以把它哄成telling you whether or not there is any application on the device that will open your file .但尚不清楚您还能做很多其他事情。

关于ios - UIDocumentInteractionController 在没有选项的特定应用程序中打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6807764/

有关ios - UIDocumentInteractionController 在没有选项的特定应用程序中打开文件的更多相关文章

随机推荐