gardefjord
gardefjord

Reputation: 41

Archive app with Xcode 4.3.1 gives pngcrush caught libpng error:

The app builds fine in a simulator and on a device. But as soon as I try to archive it for submission I get: While reading /Users/adga/Documents/Adams Lokalt/Appar/NU SÅ/VertragingsApp/Rotation/Customization/Herfst2011/../../../[email protected] pngcrush caught libpng error: PNG unsigned integer out of range.

I've tried to open in photoshop and replace (without interlacing) but it doesn't work.

Any ideas?

Upvotes: 4

Views: 9317

Answers (5)

Dima Deplov
Dima Deplov

Reputation: 3718

I receive such error when just try to run my project.

This error could occur when you have duplicate file references (I have this problem because I change my png images). You can check, all of your copying files in Bundle Resources and for me there was more than one copy of each "error png file".

You can open Bundle Resources following this steps: click on your project name in Project Navigator tab, then choose your project in Targets. After that, you must choose Build Phases tab. You'll see a list of items: "Target Dependencies", "Compile Sources", "Link Binary With Libraries", and what we're looking for Copy Bundle Resources. Here you can see all your resources that you add to your project.

To fix this error, you must remove all error files from this list.

After that you also delete this files in Project Navigator, choose all files that needs to unlink from project, than right click on them and choose delete, then choose Remove Reference. All we need is to remove all references from our project.

All things done, right now we must add our files back. Click to Project Navigator zone with right button (or to a particular folder/group) and choose Add Files to "Your Project Name" and choose all files you need to delete.

Remember, that you remove reference from files previously and they are just waiting to be added again in your project folder.

Another reason when such error occur is when .png file is not a proper .png file, in this case you need to re-save file to png extension. You can open your image file in Preview and save it to png from here. If you have a big amount of images, you can use Automator to help you in your task. Hope this help.

Upvotes: 9

Daniel Saidi
Daniel Saidi

Reputation: 6197

I received this problem when I added two images to a project that already had references to them. Once I removed the duplicate reference, the error disappeared.

Upvotes: 3

Alessign
Alessign

Reputation: 798

I had the same problem and error disappeared after simple step in photoshop. Open your existing png file with photoshop and re-save it as "Save for web & devices"...that did the trick for me!

Upvotes: 1

bangdel
bangdel

Reputation: 2553

I faced the same issue as well. I just restarted xCode and recompiled. I did not have that problem thereafter.

Upvotes: 5

Henry
Henry

Reputation: 479

I met this problem too. Though the project still could be compiled, it is really annoying.

I resaved the png without interlacing to another place and replace the original one instead of just resaving it at the original place. This did work for me, why you just try this again?

Upvotes: 4

Related Questions