小编yod*_*atg的帖子

UIDocumentInteractionController 在某些应用程序中禁用打开

我目前正在使用 UIDocumentInteractionController 来打开功能。当它打开时,它会显示设备上可以处理该文件类型的所有应用程序的列表。

有没有办法禁用我的应用程序向特定应用程序发送文档,即使它们支持该文件类型?例如 - 如果我在我的应用程序中打开了一个 PDF 文件并且 iBooks 在 iPad 上,如果我点击 UIDocumentInteractionController 中的 iBooks 图标,我不希望它发送到应用程序。

理想情况下 - 我认为这是建立一个黑名单(或白名单)。例如,这样做会很棒:

   - (void) documentInteractionController: (UIDocumentInteractionController *) controller willBeginSendingToApplication: (NSString *) application {


    // if app is blacklisted
    if ([application isEqualToString:@"com.schimera.WebDAVNavigator"]) {
        [self.interactionController dismissMenuAnimated:YES];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"FAIL" message:@"NO" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];

        return
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,即使文件被“列入黑名单”,该文件仍会发送到应用程序。

这种方法可能吗?

干杯!

objective-c uikit ios uidocumentinteraction

5
推荐指数
1
解决办法
1910
查看次数

标签 统计

ios ×1

objective-c ×1

uidocumentinteraction ×1

uikit ×1