How to properly develop for the iPhone on a PowerPC Mac?

◇◆丶佛笑我妖孽 提交于 2019-12-05 19:04:30

I had the same problems as you - I could cross compile and install the app on the iphone, but it would always fail with a security violation.

To get around it, I had to jailbreak my phone and install a patched MobileInstaller (I believe the Cydia app now has package called Installous which patches your MobileInstaller. Unfortunately, I think Installous is also used to pirate apps). Then in your project's Info.plist, you need to add the following:

<key>SignerIdentity</key>
<string>Apple iPhone OS Application Signing</string>

This will allow your phone to run unsigned binaries, which is the only way I was able to develop from my ppc mac.

I'm still able to purchase apps from the appstore and have them run without any problems.

What does your codesign script look like? I used to use this one when I was working on a G4: (The original "/usr/bin/codesign" should be renamed "/usr/bin/codesign.orig" and then save this script as "/usr/bin/codesign". You would have to do it with "sudo". Also this script doesn't work if your path names have spaces in them.)

#!/usr/bin/perl 
#
$appDir=$ARGV[$#ARGV];
@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;
}

As of 12 of April 2009, iPhone Os 2.2.1 the script fix works perfectly on my iBook G4.

Anyway, having spent the better part of the day searching for fixes on Google I see that there are quite a few people that still have problems.

Make sure you copy/paste correctly, because if you get an error in the script and fail the codesign Xcode won't notice and it will try to install the application in its unsigned state, giving you an error when deploying (NOT when building). In my case I had pasted the text in a small terminal window, breaking some lines of code and it took me one day to find the mistake. At least now I have an impressive knowledge of certificates, code signing and Xcode...

If you still have problems it's probably due to a bundle identifier/appId mismatch on which there are tons of posts.

It may also be worth bearing in mind that XCode can be a bit flaky when it comes to certificates, signing and installing on devices (perhaps just on PPC, haven't tried on an Intel mac).

I find the following steps usually sort things out when a previously-working configuration suddenly stops working:

  1. Clean all targets in XCode
  2. Delete any installed version of the app from your device (usual app uninstall procedure, click the little 'x')
  3. Quit XCode completely, and start it again

If you've never successfully signed your app there may be an actual configuration issue, but once it's working make sure you try the above before worrying something's broken :)

Hope that helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!