I have a script for building my app that is broken since updating to Xcode 4.5. The problem is code signing. When I run the following:
/usr/bin/xcrun \
-sdk iphoneos \
PackageApplication \
-v "${BUILD_DIR}/${APPLICATION_NAME}.app" \
-o "${APP_ARCHIVE}" \
--sign "${DEVELOPER_ID}"
--embed "${PROVISIONING_PROFILE}"
I get the following error:
error: /usr/bin/codesign --force --preserve-metadata --sign iPhone Developer: Apple Developer --resource-rules=/var/folders/p5/gfgpv6911ylbs52cnbh2___m0000gq/T/ky9_XtRlRr/Payload/Blah.app/ResourceRules.plist /var/folders/p5/gfgpv6911ylbs52cnbh2___m0000gq/T/ky9_XtRlRr/Payload/Blah.app failed with error 1. Output: /var/folders/p5/gfgpv6911ylbs52cnbh2___m0000gq/T/ky9_XtRlRr/Payload/Blah.app: replacing existing signature
codesign_allocate: object: /private/var/folders/p5/gfgpv6911ylbs52cnbh2___m0000gq/T/ky9_XtRlRr/Payload/Blah.app/Blah malformed object (unknown load command 34)
/var/folders/p5/gfgpv6911ylbs52cnbh2___m0000gq/T/ky9_XtRlRr/Payload/Blah.app: object file format unrecognized, invalid, or unsuitable
Something is going wrong with the code signing where it was working fine with Xcode 4.3 before. Can code signing still be done with the same command? Is this "unknown load command" the culprit, and if so, what is it, and how would one go about finding and fixing it?
Generate a Code Signing Certificate using XcodeAt the top of the window select Accounts . Click on the + on the lower left corner and select Add Apple ID... A dialog will appear. Add your Apple ID and your password, then select Sign in .
Code signing your app assures users that it's from a known source and hasn't been modified since it was last signed. Before your app can integrate app services, be installed on a device, or be submitted to the App Store, it must be signed with a certificate issued by Apple.
Mandatory code signing To help ensure that all apps come from a known and approved source and haven't been tampered with, iOS and iPadOS require that all executable code be signed using an Apple-issued certificate. Apps provided with the device, like Mail and Safari, are signed by Apple.
A signing certificate is the first requirement you need in order to be able to sign apps for installation on iOS devices. Specifically, you need a development certificate, which lets an individual install and run an app on a device.
It turns out upgrading XCode from App Store does NOT automatically upgrade everything.
Go to Preferences / Downloads and make sure the latest Command Line Tools are installed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With