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 482161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:04:06+00:00 2026-05-13T01:04:06+00:00

I’ve inherited a project that at some point creates a zip file, adds an

  • 0

I’ve inherited a project that at some point creates a zip file, adds an XML file to the zip and then adds a number of PNG files to the same archive. All works fine on the simulator, but whenever I run the same code on the device itself the resulting png files are altered and unopenable when opened on my Mac.

They still appear to be png files, but the ‘corrupt’ export ones are slightly larger than the true files are, and hex dumps show the contents differ drastically. Headers are preserved though…

Original:

00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR|
00000010  00 00 00 6d 00 00 00 75  08 06 00 00 00 44 7d 6f  |...m...u.....D}o|
00000020  a0 00 00 00 19 74 45 58  74 53 6f 66 74 77 61 72  |?....tEXtSoftwar|
00000030  65 00 41 64 6f 62 65 20  49 6d 61 67 65 52 65 61  |e.Adobe ImageRea|
00000040  64 79 71 c9 65 3c 00 00  38 32 49 44 41 54 78 da  |dyq?e<..82IDATx?|

Corrupt:

00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 04 43 67 42 49  |.PNG........CgBI|
00000010  30 00 20 02 10 f3 44 7c  00 00 00 0d 49 48 44 52  |0. ..?D|....IHDR|
00000020  00 00 00 6d 00 00 00 75  08 06 00 00 00 44 7d 6f  |...m...u.....D}o|
00000030  a0 00 00 00 19 74 45 58  74 53 6f 66 74 77 61 72  |?....tEXtSoftwar|
00000040  65 00 41 64 6f 62 65 20  49 6d 61 67 65 52 65 61  |e.Adobe ImageRea|
00000050  64 79 71 c9 65 3c 00 00  38 65 49 44 41 54 ed bd  |dyq?e<..8eIDAT??|

(I appreciate a small chunk of the file header is not very helpful but the intention is to show that the corruption occurs within the PNG and not the ZIP itself.)

So I guess what I’m asking is whether anyone has experienced anything like this before? I just tried using the following wrapper http://www.flyblog.info/catprogramming/202.html and experienced the same issue, so am guessing its libzip itself causing the issue?

Does anyone have a simple, tried and tested method for adding files to a zip file on the Ipod that I can try and swap in?

If it helps, here is the code that creates the zip:

ZipArchive* zip = [[ZipArchive alloc] init];

BOOL ret = [zip CreateZipFile2: zipPath];
NSMutableSet *imageNames = [NSMutableSet set];
[curAlbum collectImageNames:imageNames];

for (NSString *imageName in imageNames) {
    NSString *imagePath = [[NSBundle mainBundle] pathForResource:imageName ofType:@""];
    NSLog(imagePath);
    ret = [zip addFileToZip:imagePath newname:@"test.png"];
}



[zip release];

Any advice appreciated 🙂

  • 1 1 Answer
  • 0 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-13T01:04:06+00:00Added an answer on May 13, 2026 at 1:04 am

    In addition to Noah’s answer Xcode also compresses PNG files:

    Xcode Build Settings

    It might be worth setting COMPRESS_PNG_FILES = NO in the target info window.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.