Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6884179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:28:30+00:00 2026-05-27T05:28:30+00:00

OK I have app for iPad that reads magazines. All previous issues works fine.

  • 0

OK I have app for iPad that reads magazines. All previous issues works fine. I manage to make new issue (before it was done by other guy that left the firm) and to run it in simulator and on device without problems.

Now I add row for new issue of magazine in database and compress all pictures and multimedia by ZIP tool and divide them by MacHacha (because Java class that uploads demand parts from MacHacha to upload one by one) and upload it on server. In App store I downloaded magazine and can see new issue. On server new row is good have all good parameters and the size is adequate to size on disk.

When new issue finnish download it shows me error. I tried same procedure from simulator and in OUTPUT in the moment it crashes shows me decompression error (0).

I supposed that problem is with putting parts together with MacHacha. Can anyone help or give me that catch that solves this problem.

if it will help I can upload new issue and provide link (it’s free) I it will be helpful for You guys and girls 🙂

http://www.mazzantieditori.it/applicazioni/219-nycit-italian-american-magazine.html

link for application. In library there is few issues and the last one is new (Giugno 2011).

I will provide code for that method that gives me string for mistake:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection

{
// controllo se il receipt è corretto e faccio partire il download
if(min == 0 && [receivedData length]

NSString *file = [[self documentsDir:1] stringByAppendingPathComponent:@"archivio.zip"];

if (max <= num && !cancelDownload) {
    self.progressBar.progress = (1.0f/num)*min;
    min = max+1;
    max += 5;

    // creo directory per l'elemento scaricato
    BOOL isDir = NO;

    if(![[NSFileManager defaultManager] fileExistsAtPath:file isDirectory:&isDir]) {
        NSError *error;
        //creo directory
        [[NSFileManager defaultManager] createDirectoryAtPath:[self documentsDir:1] withIntermediateDirectories:YES attributes:nil error:&error];
        //creo file vuoto
        [[NSFileManager defaultManager] createFileAtPath:file contents:nil attributes:nil];
    }

    NSFileHandle *handler = [NSFileHandle fileHandleForWritingAtPath:file];

    if(handler) {
        [handler seekToEndOfFile];
        [handler writeData:receivedData];
    }
    NSLog(@"Received %d bytes of data; min: %i max: %i",[receivedData length],min,max);
    [receivedData setLength:0];

    // questa è la seconda invocazione
    [self downloadArchivePart:@"verified"];
    [connection release];
    return;
}

NSFileManager *man = [[NSFileManager alloc] init];
NSDictionary *attrs = [man attributesOfItemAtPath:file error: NULL];
//UInt32 result = 
NSNumber *size = [attrs objectForKey:NSFileSize];
//int length = [receivedData length];
NSLog(@"Succeeded! Received %i bytes of data",[size intValue]);
[man release];

//1.038.090 è il numero di byte della parte più piccola dell'archivio
if([size intValue]  >= kMinPartSize) {  

    NSLog(@"prod %@",self.prodName);
    if(self.prodName == nil || [self.prodName isEqualToString:@""]) self.prodName = prodId;         

    NSError *error;
    BOOL ok = [TWZipArchive unzipFileAtPath:file toDestination:[self documentsDir:1] overwrite:YES password:nil error:&error];
    //unzipFileAtPath:file toDestination:[self documentsDir]];

    NSString *msg;
    if(ok) {
        NSLog(@"decompression successfull");
        self.progressBar.progress = 1.0f;
        NSFileManager *fm = [NSFileManager defaultManager];
        [fm removeItemAtPath:file error:&error];
        msg = @"Download completed: new issue added in libray";

        NSMutableArray *array;
        NSMutableDictionary *dict = [NSMutableDictionary dictionary];
        NSString *path = [[self documentsDir:0] stringByAppendingPathComponent:@"downloaded.plist"];
        if(![[NSFileManager defaultManager] fileExistsAtPath:path]) {   
            [dict setObject:prodId forKey:@"id"];
            [dict setObject:prodName forKey:@"titolo"];
            array = [NSArray arrayWithObject:dict];
            [array writeToFile:path atomically:YES];
        }
        array = [NSMutableArray arrayWithContentsOfFile:path];
        BOOL exist = NO;
        for (int i=0; i<[array count]; i++) {
            if ([[[array objectAtIndex:i] objectForKey:@"id"] isEqualToString:prodId]) {
                exist = YES;
                //prodId = [NSString stringWithFormat:@"%@%i",prodId,i];
            }
        }   

        if(exist == NO) {
            [dict setObject:prodId forKey:@"id"];
            [dict setObject:prodName forKey:@"titolo"];
            [array insertObject:dict atIndex:0];    //sempre in testa l'ultimo elemento scaricato
            [array writeToFile:path atomically:YES];
        }

    }
    else {
        NSLog(@"decompression error");
        msg = @"An error has occurred";
    }

    //[myAlert release];
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"NYC.IT"
                                                    message:@"Download completed: new issue added in libray"
                                                   delegate:self 
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles: nil];
    [alert show];

    //[alert release];
}else {

    if(cancelDownload == YES) {

        UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"NYC.IT"
                                                        message:@"Download stopped for user action" 
                                                       delegate:self 
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles: nil];
        [alert show];

    }else {

        NSString *errFile = [[self documentsDir:1] stringByAppendingPathComponent:@"errFile.html"]; 
        [receivedData writeToFile:errFile atomically:YES];
        NSLog(@"err : %@",errFile);
        NSLog(@"scrittura error file eseguita");

        NSLog(@"receipt non valido");
        UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"NYC.IT"
                                                  message:@"Downloading error: please retry later!" 
                                                  delegate:self 
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles: nil];
        [alert show];
    }


}
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
progressBar.hidden = YES;

// release the connection, and the data object
[connection release];
//[receivedData release];

}

Thanks in Advance…

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:28:31+00:00Added an answer on May 27, 2026 at 5:28 am

    I dont know about x-code but this is useful library
    http://www.winimage.com/zLibDll/minizip.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iPad app that works both on and offline but when I
I have an iPad app that uses custom fonts though the UIAppFonts elements in
I have an iPad app that has a UITableViewController that implements the NSFetchedResultsControllerDelegate .
I have this iPad app using Storyboard. There are some file that are marked
I know that after I have deployed my ipad/iphone app into App Store, it
I have a iPad app which is NOT modified for the new iPad with
I have an iPad app that submits orders to an ASP.NET MVC web site
I have an iPad app that uses Core Data for data storage. I would
I have an iPad app that records video and sends it to my SaaS
I have an iPad app that uses the storyboard board feature and then I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.