URLを介してダウンロードされているファイルを解凍しようとしています。ダウンロードしたファイルはzip形式です。私はライブラリを使用しました:iPhone Unzip codeにはSSZipArchiveライブラリがあります。ダウンロードされたファイルを解凍するために現在のコードで使用されます。しかし、スタンドアローンのアプリケーションとしてアプリケーションを実行すると、ログエラーが発生してクラッシュします。example.appは時間内に起動できませんでした。私はこのライブラリを使用することができるかどうか、または試してテストされ、デバイス上で実行されている他のライブラリがあるかどうかはわかりません。タイムアウトのため、デバイス上のファイルの解凍がクラッシュする
- (void)viewDidLoad {
[super viewDidLoad];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *directoryPath = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/ZipFiles.zip", directoryPath];
NSString* updateURL = @"http://www.example.com/test.php?id=11";
NSData* updateData = [NSData dataWithContentsOfURL: [NSURL URLWithString: updateURL] ];
[fileManager createFileAtPath:filePath contents:updateData attributes:nil];
/* SSZipArchive is a free API built on ZipArchive to unzip the files. Header file is passed in this class.*/
[SSZipArchive unzipFileAtPath:filePath toDestination:directoryPath];
NSLog(@"Finished unzipping database");
}