简体   繁体   中英

iOS app manually signed and zipped does not upload to App Store

I've been struggling for a couple of days now...

I have an app that works great in AdHoc and now I'm delivering a .ipa to the customer for uploading to their private store.

I'm using XCode6.4 and Swift, and archived through xCode.

During the first attempts the app was crashing for the customer with the following log:

Library not loaded: @rpath/libswiftCore.dylib
Referenced from:  /private/var/mobile/Containers/Bundle/Application/F223C4F8-4CBA-4474-9809-79D80C5AB11F/appname.app/appname
Reason: no suitable image found.  Did find:
/private/var/mobile/Containers/Bundle/Application/F223C4F8-4CBA-4474-9809-79D80C5AB11F/appname.app/Frameworks/libswiftCore.dylib: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/F223C4F8-4CBA-4474-9809-79D80C5AB11F/appname.app/Frameworks/libswiftCore.dylib'
Dyld Version: 353.12

After many attempts to fix this I tried to manually sign the app. When decompressing the "somename.ipa" I get a "somename" folder with 3 subfolders: Payload, SwiftSupport, Symbols. I ran: codesign --force --verbose --sign 'iPhone Distribution: certificate' appname.app/

and then: codesign --force --verbose --sign 'iPhone Distribution: certificate' appname.app/Frameworks/*

And the resulting CodeResources file looked exactly the same as before. So then I did it the other way around - signed the frameworks first and the app after that. This time I got a CodeResources file that had different hashes for the framework files and same hashes as before for the rest of the files.

Now, I zipped the "somename" folder and changed the extension from ".zip" to ".ipa". Note it still has the same structure.

Now when the customer tries to upload they get the following answer: "submission error: this build did not pass automatic validations Fatal errors: - Application directory structure should be Payload/appname.app/"

the .ipa does include that directory, I doubled and tripled checked, along with the (new) Swift top directory and the symbol files directory.

Not sure where to go with this...

I'm using following script command to resign application with new provision:

#Pulls the entitlements out of the provision profile
/usr/libexec/PlistBuddy -x -c "print :Entitlements " /dev/stdin <<< $(security cms -D -i $PROVISION_PATH/$ADHOC_PROVISION) > entitlements.plist

#Remove old CodeSignature
rm -rf Payload/$1.app/_CodeSignature Payload/$1.app/CodeResources

# Replace embedded mobile provisioning profile
cp $PROVISION_PATH/$ADHOC_PROVISION Payload/$1.app/embedded.mobileprovision

# Re-sign
/usr/bin/codesign --verify -f --sign "iphone distribution" --resource-rules=Payload/$1.app/ResourceRules.plist --entitlements entitlements.plist Payload/$1.app

# Re-package
zip -qr $1.adhoc.ipa Payload

Where

$1 - Application name

$PROVISION_PATH/$ADHOC_PROVISION - new provision profile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM