reaper
reaper

Reputation: 423

How to embed custom resources and folders in iOS applications

I have an iOS application that embeds a native C binary bundled as a static library. This binary was initially designed to work on "regular" computers and relies on some specific folder layout, something like:

myapp
- images
  - big
  - thumbnails
- templates
- sounds

For the binary to work properly, I need to keep this layout as it is. I haven't done much iOS development and maybe this is a trivial question, but how can I replicate this folder layout within my iOS application (and how to get its absolute path within the application) ?

Upvotes: 0

Views: 208

Answers (1)

Miles Alden
Miles Alden

Reputation: 1540

Every app has a sandbox with a set of folders that you could use. Would your app still function if they were in say the Documents or Library folder?

 NSString *documentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
 NSString *libraryDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];

There is also /tmp and /caches, but probably these aren't what you're looking for. I believe both of the above survive updates/sync.

Upvotes: 2

Related Questions