Ok guys I ran into this same problem last year when I was starting to develop for the iPhone. The whole lot is universal binaries (and will work fine if you use the tips above) apart from one little thing - codesign is intel only.
You can work around this with a bit of tinkering as follows...
rename /usr/bin/codesign to /usr/bin/codesign.orig
now create a new codesign file and fill with the following perl script
Code:
#!/usr/bin/perl
#
$appDir=$ARGV[$#ARGV];
$appDir=~s/ /\\ /g;
@tmpAry=split(/\//,$appDir);
$baseAppName=$tmpAry[$#tmpAry];
$baseAppName=~s/\.app$//;
$realAppName="$appDir"."/$baseAppName";
$sign=0;
for($b=0;$b<$#ARGV;$b++) {
if($ARGV[$b] eq "-s") {
$sign=1;
}
}
$mums=`file $realAppName`;
if($sign==1 && $mums=~/executable arm/) {
#print "Signing armv6..\n";
$dev="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/";
$tmp="$appDir"."/tmpbin";
`$dev/lipo -create $realAppName -output $tmp`;
`mv $tmp $realAppName`;
system("/usr/bin/codesign.orig",@ARGV);
`$dev/lipo -thin armv6 $realAppName -output $tmp`;
`mv $tmp $realAppName`;
system("rm $appDir"."/CodeResources");
system("cp $appDir"."/_CodeSignature/CodeResources $appDir"."/CodeResources");
exit 0;
} else {
exec '/usr/bin/codesign.orig',@ARGV;
}
set as executable and you should now be able to run 'on device' quite happily
btw; one little trick that got me for a while
See the two lines here
Code:
system("rm $appDir"."/CodeResources");
system("cp $appDir"."/_CodeSignature/CodeResources
For some reason the iPhone won't follow the symbolic link to CodeResources so instead we need to copy the location BUT when you actually want to codesign something properly you must comment these two lines out.
ie you want to submit your app to apple for the app store!
ps; please note, I have never tried this on any SDK other than the initial 'final' release, so it might not work with any of the newer versions. Let me know if it does though, then I can upgrade too :P