views:

33

answers:

1

How do you compile a resource into the binary in XCode? That way is doesn't show up inside the application bundle as a file and it's not subject to manipulation by a user (whether good-intentioned or bad).

Is this even possible?

I'm particularly interested about this in terms of iPhone apps.

Any help is appreciated!

+1  A: 

You can process the resource into a header file with a byte array if it’s not too big:

char TOP_SECRET[] = {
    84, 111, 112, 32, 115, 101,
    …
};

And you can encrypt or obfuscate the resource, be it in a standalone file or in a binary, so that it’s harder to search the binary for a known header or magic sequence. A simple XOR will do for most purposes.

zoul
You could also set up Xcode to automatically generate this header during build if the top-secret file changed.
Jason Coco