2012-05-23 4 views
1

사람,압축 또는 압축 iOS sqlite 데이터베이스

어떻게 iOS 앱의 sqlite 데이터베이스를 압축 할 수 있습니까? 왜냐하면 나는 그것을 구름과 함께 가라 앉히려고하지만 약간의 문제가있는 메신저 ...

내가 지퍼로 사용하기 위해 어떤 수업을해야합니까? 제발 도와주세요!

답변

4

당신은 ZipArchive, 자사의 목표 C 래퍼를 사용할 수 있습니다 - 우편 번호에 대한 http://code.google.com/p/ziparchive/

: - 특별히

NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString* dPath = [paths objectAtIndex:0]; 
    NSString* txtfile = [dPath stringByAppendingPathComponent:@"test.txt"]; 
    NSString* zipfile = [dPath stringByAppendingPathComponent:@"test.zip"]; 
    ZipArchive* zip = [[ZipArchive alloc] init]; 
    BOOL ret = [zip CreateZipFile2:zipfile]; 
    ret = [zip addFileToZip:txtfile newname:@"test.txt"];//zip 
    if(![zip CloseZipFile2]) 
    { 
     zipfile = @""; 
    } 
    [zip release]; 
    NSLog(@"The file has been zipped"); 
+0

구체적으로 어떻게 압축 할 수 있습니까? .sqlite 아카이브? 어떻게 접근 할 수 있습니까? – JRafaelM

+0

db 파일의 경로를 모르십니까? – saadnib

+0

그것은 애플 리케이션의 자원에 있지만, 나는 IOS가 너무 릴 잃어버린 그래서 아카이브에 근무 ... – JRafaelM

0

당신은에서 확인할 수있다 Zlib을 사용할 수 있습니다 : 압축 풀기/압축하기 http://code.google.com/p/objective-zip/

+0

.sqlite 아카이브를 압축하는 방법은 무엇입니까? 어떻게 접근 할 수 있습니까? – JRafaelM

+0

당신은 코드를 필요로합니다 ... 당신의 소스에 복사하여 붙이기 만하면됩니다 ... – samfisher

+0

아니요, 제 파일 시스템을 사용하지 않은 내 db archive cuz를 찾는 방법이 필요합니다 ... – JRafaelM