Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-17-2010, 07:53 PM   #41 (permalink)
intomo
Registered Member
 
Join Date: Jul 2009
Posts: 62
intomo is on a distinguished road
Default what else am I doing wrong?

So I've added the function
Code:
- (NSString *)dataFilePath
{
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSString *documentsDirectory = [paths objectAtIndex:0];
	return [documentsDirectory stringByAppendingPathComponent:l_zipfile];
}
and then I've modified the zip creating function

Code:
-(IBAction)createZip:(id)sender
{
	
	NSLog(@"Entering %s", __FUNCTION__);
	
	NSString *filePath = [self dataFilePath];
	
	ZipArchive *currentZip = [[ZipArchive alloc] init];
	BOOL ret = [currentZip CreateZipFile2:filePath];
	// OR
	//BOOL ret = [zip CreateZipFile2:l_zipfile Password:@"your password"]; //
	//if the Password is empty, will get the same effect as [zip CreateZipFile2:l_zipfile];
	
	
	
	ret = [currentZip addFileToZip:@"happyJack.png" newname:@"jack.png"];
	if( ![currentZip CloseZipFile2] )
	{
		NSLog(@"Zip Error");
	}
	[currentZip release];
}
So it works and the zip file magically appears in the Documents directory. However, when I click on it it says "the file is empty". What else am I doing wrong?

Thanks again!
intomo is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,486
Threads: 94,041
Posts: 402,629
Top Poster: BrianSlick (7,978)
Welcome to our newest member, hughricotta
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:05 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.