Binary support

  • Chris Evans

    Chris Evans - 2008-08-08

    It turns out there's a much easier way of adding support for downloading binaries:

    NSData* fileData = [NSData initWithContentsOfURL:fileURL];
    [fileData writeToFile:fileName atomically:YES];
    [fileData release];
    [fileURL release];

    I haven't tested it yet, so I haven't checked it in.

    • Chris Evans

      Chris Evans - 2008-08-09

      I tested it out.  I missed an alloc:

              NSURL* fileURL = [[NSURL alloc] initWithScheme:@"http" host:hostName path:pathToFile];
              NSData* fileData = [[NSData alloc] initWithContentsOfURL:fileURL];
              [fileData writeToFile:pathToStoreFile atomically:YES];
              [fileData release];
              [fileURL release];

      The code is checked in, and it works.  I downloaded a PNG file and an XML file and checked the checksums.


Log in to post a comment.