Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My solution for this was to setup a zip file on my Mac, then have the iPhone app detect if the assets were downloaded, if not, grab them from the Mac and unzip. Then the app is slim, and downloads what it needs. This is only for debugging purposes, in the end, you would like to have all the assets installed, so people don't have to download after they've installed. The relevant code looks something like this (no error checking, and you may need to adjust the paths). I've been using the excellent ASIHTTP <a href="http://allseeing-i.com/ASIHTTPRequest/" rel="nofollow noreferrer">library</a>, and the <a href="http://code.google.com/p/ziparchive/" rel="nofollow noreferrer">ZIPArchive</a> project. You'll need to change your download URL.</p> <pre> BOOL isDirectory; BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:installDirectory isDirectory:&isDirectory]; NSLog ( @"Checking for file: %@", installDirectory ); if ( !fileExists ) { NSString* path = [docsPath stringByAppendingString:@"foo.zip"]; NSLog ( @"Download file!" ); NSURL *url = [NSURL URLWithString:@"http://10.0.0.11/~blezek/foo.zip"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDownloadDestinationPath:path]; [request startSynchronous]; // Now unzip ZipArchive *zipper = [[[ZipArchive alloc] init] autorelease]; [zipper UnzipOpenFile:path]; [zipper UnzipFileTo:docsPath overWrite:NO]; NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager removeItemAtPath:path error:NULL]; } </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload