In order to save on server side bandwidth costs associated with my iOS application, I've packaged a bunch of assets that would otherwise be downloadable at runtime into my iOS application bundle. In the context of the application as written, it would be ideal for me if I could access the files from one of the user writeable directories (e.g. [App Dir]/Library/Application Support/My Custom Subfolder/
) without having to copy the files there directly at runtime (e.g. at startup, first run, whatever).
While I've been able to successfully create symbolic links in .../My Custom Subfolder/
to the files in the bundle using the NSFileManager
API createSymbolicLinkAtURL:withDestinationURL:error:
, some of the framework APIs I then use to access the content later on get goofed up and give me back attributes and data pertaining to the symbolic links instead of the underlying file. I could probably mitigate those issues by utilizing some other framework APIs but it might end up being a lot of work depending on the scope of the incorrect usages.
On the simulator I was able to successfully circumvent this issue by creating hard links to the bundle content using the NSFileManager
API linkItemAtURL:toURL:error:
. The hard links worked great for all the file access APIs utilized throughout the app and everything was peachy. On DEVICE however (tested on iPhone 5c running iOS 7.0.2 and iPad running iOS 7.1), I would receive an NSCocoaErrorDomain 513 error (Operation could not be completed. Operation not permitted.)
. I could create a test file in .../My Custom Subfolder/
and create a hard link to that in the same folder just fine, but if I try to hardlink to anything in the read-only application bundle, I get the 513 error.
Does anyone know if there's a way to get around the permissions error in order to accomplish what I'm trying to do?