如何在 UIDocumentInteractionController 上设置 "Copy To (My app)"

How to have "Copy To (My app)" on a UIDocumentInteractionController

如何在 UIDocumentationController 中包含 "Copy To MyExampleApp"。 文件类型可以是任何一种:pdf、pptx、doc、txt ...

P.S : Objective-C 代码会有所帮助。 谢谢!

//AppDelegate.m
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication (NSString *)sourceApplication annotation:(id)annotation {
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filePath = [fileURLFromLaunch path];
BOOL success = [fileManager copyItemAtPath:filePath toPath:finalFilePath error:&error];
if (success) {
    NSLog(@"success");
}}

尝试将 DocType 支持添加到您的应用程序以进行扩展,然后处理委托以完成必要的工作。

参考:Registering the filetypes your app supports