在另一个应用程序中打开文件时,在UIDocumentInteractionController中更改文件名

Lee*_*Lee 3 cocoa-touch uikit ios uidocumentinteraction

我以一种掩盖文件原始名称的方式将文件存储在我的应用程序沙箱中.

例如,我有一个名为abc.png的文件,它以obfuscated.png的形式存储在沙箱中.

当我使用UIDocumentInteractionController在另一个应用程序中打开此文件时,我想让另一个文件打开文件名为abc.png的文件

目前,另一个应用程序将文件打开为obfuscated.png.

我已经尝试更改in 的name属性以及,但是在这两种情况下接收应用程序都没有获得正确的文件名 - 它继续显示模糊的文件名.UIDocumentInteractionControllerdocumentInteractionControllerWillPresentOptionsMenuwillBeginSendingToApplication

除了使用未经模糊处理的名称创建文件的副本之外,有没有办法让接收应用程序使用所需的文件名?

小智 6

而不是复制尝试:

NSError *error = nil;
[[NSFileManager defaultManager] linkItemAtPath:obfuscatedFilePath toPath:abcFilePath error:&error];
Run Code Online (Sandbox Code Playgroud)

这将创建文件的硬链接.符号链接不起作用.