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

为君一笑 提交于 2019-12-10 09:35:00

问题


I'm doing iPhone development on a PowerPC Mac. How do I get code signing to work properly so that I can build to my iPhone?

The iPhone SDK doesn't officially support PowerPC, but with some fidgeting, it can be installed. See here. I've got the SDK installed and running fine in Xcode and the iPhone simulator works fine.

However, I can't build to my iPhone in Xcode -- the code signing is fubar. Some clever people have created workarounds here. Namely, I used the codesign script that Tiku posted along with some of the corrections. This has helped me make some progress. The code compiles now, but I still get an 0xE800003A error when it tries to deploy.

I think I have all my keys and provisioning profiles set up properly. My iPhone is registered for development, I've got the provisioning profile created. The AppID listed in the dev portal says MagicNumber.com.website.* and in my project, I have the Bundle ID set as com.website.${PRODUCT_NAME:identifier}. In project settings, product name is HelloWord, and the code signing identity is my developer certificate.

The console log of the iPhone says: Wed Feb 18 14:57:55 unknown afcd[180] : user mobile has uid 501

Wed Feb 18 14:57:55 unknown afcd[180] : mode is 0x41e8 Wed Feb 18 14:57:55 unknown mobile_installation_proxy[182] : install_embedded_profile: Skipping the installation of the embedded profile Wed Feb 18 14:57:55 unknown mobile_installation_proxy[182] : verify_executable: Could not validate signature: e800800e Wed Feb 18 14:57:55 unknown mobile_installation_proxy[182] : preflight_application_install: Could not verify /var/tmp/install_staging.QNk2sD/HelloWorld.app/HelloWorld Wed Feb 18 14:57:55 unknown mobile_installation_proxy[182] : install_application: Could not preflight application install Wed Feb 18 14:57:55 unknown mobile_installation_proxy[182] : handle_install: Installation failed

Any help is appreciated!


回答1:


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.




回答2:


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;
}



回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/563332/how-to-properly-develop-for-the-iphone-on-a-powerpc-mac

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