Xcode Build and Archive Sharing Problem (and Solution)
Sunday, April 17, 2011 at 6:39PM In this post I assume that you know how to create an ipa file from Xcode. For info on how to do that, check this article out: http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-3
Recently I ran into an annoying issue while trying to create an ipa file using Build and Archive. Xcode would compile and verify the app fine, but when I tried to share the archive application (via Organizer->Archived Applications->Share), a spnner would appear and go away and the usual Save ipa file dialog would not appear.

It's apparent (or maybe not) that something is causing Xcode to bail out of the process. The next step is to figure out how we can get more info that tells us why Xcode is not behaving the way it normally does.
To achieve that, let's eliminate Xcode out of the picture and get our hands dirty by building the app from the good old terminal and hopefully that will allow us a better picture on what went wrong.
1. Build the project to .app file
xcodebuild -target "${PROJECT_NAME}" -sdk "${TARGET_SDK}" -configuration Release
In our case, the command is
xcodebuild -target "Word Tracer" -sdk "iOS 4.2" -configuration "Ad Hoc"
Note: You can skip this step by building in Xcode.
2. package .app file into an .ipa file
/usr/bin/xcrun -sdk iphoneos PackageApplication -v"${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o"${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}”
In our case, the command is
/usr/bin/xcrun -sdk iphoneos PackageApplication -v build/Ad\ Hoc-iphoneos/WordTracer.app -o WordTracer.ipa --sign "test name" --embed "/Projects/WordTracer/test.mobileprovision"
Sure enough, I got the error below after running the command.
+ /usr/bin/codesign --verify -vvvv -R=anchor apple generic and (certificate 1[field.1.2.840.113635.100.6.2.1] exists and (certificate leaf[field.1.2.840.113635.100.6.1.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)) /tmp/r3kFZTMcqd/Payload/WordTracer.app
Program /usr/bin/codesign returned 1 : [/tmp/r3kFZTMcqd/Payload/WordTracer.app: a sealed resource is missing or invalid
/tmp/r3kFZTMcqd/Payload/WordTracer.app/letter_data/hei_计.plist: resource added
/tmp/r3kFZTMcqd/Payload/WordTracer.app/letter_data/hei_计.plist: resource missing
]
Great, now we got more info that we did in Organizer. Armed with this piece of info we can begin to investigate what halted the build process. It looks like hei_计.plist is the culprit. I double checked the file name in terminal. It turned out that there is a character \036 in it which won't appear in Finder (another reason why you should always rely on Terminal for things like this). A quick conversion from \036 (octal) to hex gives us 0x1E. It looks like this is a control character of some sort (http://www.fileformat.info/info/unicode/char/1e/index.htm) and this is what was causing a hiccup in the ipa packaging process.
I proceeded to remove the character \036 from the filename, rebuilt the app and this time Organizer allowed me to save the ipa file like it normally does.
zitao |
3 Comments |
iOS,
iPhone,
xcode in
Development 






