Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

iPhone SDK CodeSign Error

I have been using the iPhone SDK and the app. runs on the sim, but it will not allow me to test it on the device. I get an CodeSign Error. How do apply the Developer cert.?

iPhone, Mac OS X (10.5.2)

Posted on Mar 23, 2008 4:20 PM

Reply
64 replies

Aug 6, 2008 6:18 AM in response to Tiku

Tiku, thanks very much - your codesign script works for me!

I did have a problem with codesign_allocate complaining about "unknown architecture specification flag: -a arm", but setting the CODESIGN_ALLOCATE environment variable to "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate" seems to fix it.

Michael - I was also getting a 0xe8000001 error after using Tiku's script. It turned out it was an unrelated issue: I'd forgotten to set the Bundle Identifier in Info.plist to match the AppId in my provisioning profile. Have a look at the Console log in the organizer, it might give you a hint as to what the problem is.

Aug 21, 2008 4:25 AM in response to Forever Knight

Thanks for all the help, at last it WORKED!!

Ok here is the key stuff:
(1) that DeveloperDiskImage.dmg file is a must indeed, since I installed the code in a G4 machine, the Xcode installer simply ignored that stuff!! I installed it manually.
(2) Those two lines "system("rm $appDir"."/CodeResources");
system("cp $appDir"."/_CodeSignature/CodeResources $appDir"."/CodeResources");" in the abovementioned script I re-posted is a must, although the author himself is not sure why he needs them!!
(3) Apple has to release a revised documentation else there will be lots of unhappy programmers 'bricking' their iPhones

Thanks again.

p.s. keep the OS X 10.5.x cd handy for a reinstall, for many shell commands are run with 501 grant using sudo!! lol

Aug 26, 2008 11:01 AM in response to Forever Knight

Hey, I am trying to get the SDK to work with my PowerBook as well. I made the changes in Tiku post and was able to codesign my applications just fine. But, I am still having problems with 0xe8000001 errors. It happens whenever I connect my iPhone and organizer instantly, even if I don't try to send an app to the phone. Also happens when I try build my app for ad Hoc distribution and drop it into iTunes, it then gives that error when it is trying to sync. I don't think it is because of the AppID because I just made a total *.

Where did you get your DeveloperDiskImage.dmg from?

Aug 28, 2008 10:09 PM in response to Forever Knight

Oh, thanks I could have sworn I looked there for it before. I got running apps on my iPhone for Xcode working finally!

Though I am still having problems with trying to install an app compiled for Ad Hoc distribution through iTunes, getting the 0xe8000001 error. I followed all the instructions on the iPhone developer site, I have the Distribution cert installed, have the Ad Hoc provisioning profile installed, and have them both selected in project settings for the Distribution profile. So I tried to build and go with the configuration that used the distribution cert/provisioning profile and got 0xe8000001 error in Xcode. I really don't think I did anything wrong with the cert/profile for distribution, I have check like 5 times. Is there anyway this can had to do with it being on a PPC?

Sep 16, 2008 6:34 AM in response to Andreas Amann

Might sound like a noob question, but then I am a noob with macs. I'm stuffed if I can get that script to work for me. I've used terminal, logged in as root, to mv the old codesign to codesign.orig. I've created the new codesign (properly I think) with the contents of the script that tiku so kindly provided, but when I compile the app I get this:
can't exec 'usr/bin/codesign'
It definitely exists. I can see it when I do an ls from Terminal, I can see it from my networked Windoze machine, but the thing won't do the business for my iPhone dev.
I've chmod a=rwx
It looks to have all the permissions it needs. It's groups are root and wheel.
I'm all paid up as a developer, and have generated the certificates etc. properly I'm pretty sure. I've downloaded the iPhone 2.1 SDK, and can compile and run my app in the simulator. The colours are all wrong, because of the endianness I presume (it's an open GL app).
It's just this script will not execute for me and it's driving me nuts.
Any help or advice, gladly accepted.

DO I need to change anything anywhere to make Xcode run it in a shell?
How did you guys go about creating and getting this script to execute?

Sep 18, 2008 7:43 AM in response to brisbanebazza

All sorted. Had two problems that I'll post here for posterity, it might help someone else.
1: I'd cut and pasted the script into wordpad because I was on my Windoze machine at the time, then saved it accross the network to the mac. of course Wordpad put carriage return / linefeed pairs on each line. When I opened the script on the mac in Vi, I saw all the ^M at the end of each line.
I deleted them and saved the file back out.
2: I needed to do a chmod 755 codesign
This made it executable.

I did all this from superuser mode in Terminal in case anyone else is wondering.
Now we're all good and the app is uploading and running on the iPod touch frm my trusty G5.
Thanks heaps for the tips on this page guys. You rock !

Oct 19, 2008 8:04 PM in response to Andreas Amann

Andreas, you're a life saver! Thank you for your addition for paths with spaces in them. I've been at this for well over half the day and couldn't get it to build and transfer to my iPhone UNTIL I added your one liner. In the spirit of possibly making it clearer:

*_At the beginning of Tiku's code, change this:_*
#!/usr/bin/perl
#
$appDir=$ARGV\[$#ARGV];
$tmpAry=split(/\//,$appDir);

*_to this:_*
#!/usr/bin/perl
#
$appDir=$ARGV\[$#ARGV];
$appDir=~s/ /\\ /g;
$tmpAry=split(/\//,$appDir);

Leave the rest of the script as is and save. I ended up chmod'ing the new codesign file to 555 to match the original codesign permissions.

I am able to build & go successfully to the "simulator - iPhone os 2.1" as well as to "device - iphone os 2.1." I am using the latest SDK 3.1.1 within Leopard 10.5.5 on an 800Mhz Powerbook G4 DVI with the original iPhone running iphone os 2.1.

Oct 20, 2008 3:56 AM in response to Randy Walker

Just wondering, has anyone actually managed to upload to the app store from the G5?
I can run in simulator, run on the device, run as "ad hoc" but I keep getting the message that the app failed verification.
I'm not sure if it's something in the script, or something with the actual version of codesign on the G5 or an endian issue.
Anyone got any tips, clues or even the word that it can be done from a G5?

Oct 21, 2008 2:43 AM in response to brisbanebazza

Mate, I am having the exact same problem.

I have used the script above and can successfully codesign and run on device in either developer mode or ad-hoc distribution mode (have sent app plus provisioning profile to friends for beta testing with no problems) but when it comes to app store distribution mode my codesign verification fails every time.

A check in terminal shows some issue occurring with CodeResources?

$ codesign -vvvv /Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app
/Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app: a sealed resource is missing or invalid
/Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app/CodeResources : resource added



If I try and resign my app manually in terminal then I get no errors appearing about the signing, but when checking again with –vvvv I still have the same problems.

$ export CODESIGN ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesignallocate

$ codesign -f -s "iPhone Distribution: My Name" --resource-rules=/Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp .app/ResourceRules.plist --entitlements /Users/trapper/Desktop/MyApp/build/MyApp.build/Distribution-iphoneos/MyApp.buil d/MyApp.xcent /Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app
/Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app: replacing existing signature

$ codesign -vvvv /Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app
/Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app: a sealed resource is missing or invalid
/Users/trapper/Desktop/MyApp/build/Distribution-iphoneos/MyApp.app/CodeResources : resource modified

iPhone SDK CodeSign Error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.