SandCastle

SandCastle is a SpringBoard hook with an accompanying client library, exposing an interface for writing files outside of Apple’s application sandbox.

This document is NOT complete. This document does not necessarily represent the final state of the SandCastle API. All wrongs reversed.

For example, the following code (if inserted into an App Store app via a hook, or into various system applications such as MobileMail and MobileSafari) will fail to create a file:

NSDictionary *dict =// Create dict, store data, anything.
[dict writeToFile:@"/var/mobile/Media/Whatever.plist" atomically:NO];

The reason for this is that the kernel rejects the FSWRITE request.
One logical way around this would be to write to a temporary file, and then have something privileged move that temporary file to its final destination. That same call would, empowered by SandCastle, look as such:

NSDictionary *dict =// Create dict, store data, anything.
NSString *filename = @"/var/mobile/Media/Whatever.plist";
NSString *tempname = [[SandCastle sharedInstance] temporaryFileForFile:filename];
[dict writeToFile:tempname atomically:NO];
[[SandCastle sharedInstance] resolvePath:filename];