如何用签名者打包ipa为phonegap项目

时间:2013-08-20 12:05:41

标签: ios xcode cordova

我为ios创建了一个phonegap项目。我使用phonegap命令行来构建./cordova/build。然后我使用xcrun生成ipa,它失败了。

这是我的命令行:

xcrun -sdk iphoneos PackageApplication -v ./build/page.app -o ~/Documents  
/ipas/page.ipa -sign "iPhone Distribution: [XXXXXXX]" -embed "XXX.mobileprovision"

这是我执行命令后得到的错误。

Output directory: '/Users/longfei/Documents/ipas/page.ipa'
Temporary Directory: '/var/folders/n9/1pqsg0kj667d741s43cfnlw80000gn/T/kLf7Emmi2L'  (will NOT be deleted on exit when verbose set)
+ /bin/cp -Rp ./build/page.app /var/folders/n9/1pqsg0kj667d741s43cfnlw80000gn/T/kLf7Emmi2L/Payload
Program /bin/cp returned 0 : []
Checking original app
+ /usr/bin/codesign --verify -vvvv ./build/page.app
Program /usr/bin/codesign returned 1 : [./build/page.app: code object is not signed at all
In architecture: i386
]
Codesign check fails : ./build/page.app: code object is not signed at all
In architecture: i386

Done checking the original app
Embedding '~/Dropbox/Works/xcode/zs/yunsite1/yunsite1.mobileprovision'
+ /bin/rm -rf /var/folders/n9/1pqsg0kj667d741s43cfnlw80000gn/T/kLf7Emmi2L/Payload/page.app/embedded.mobileprovision
Program /bin/rm returned 0 : []
+ /bin/cp -rp ~/Dropbox/Works/xcode/zs/yunsite1/yunsite1.mobileprovision /var/folders/n9/1pqsg0kj667d741s43cfnlw80000gn/T/kLf7Emmi2L/Payload/page.app/embedded.mobileprovision
Program /bin/cp returned 1 : [cp: ~/Dropbox/Works/xcode/zs/yunsite1/yunsite1.mobileprovision: No such file or directory
]
error: Unable to copy '~/Dropbox/Works/xcode/zs/yunsite1/yunsite1.mobileprovision' to '/var/folders/n9/1pqsg0kj667d741s43cfnlw80000gn/T/kLf7Emmi2L/Payload/page.app/embedded.mobileprovision'

我是ios和phonegap的新手。我已经搜索了很长时间才得到解决方案,但都失败了。希望您能够帮助我。非常感谢。

1 个答案:

答案 0 :(得分:1)

您的命令行看起来很好(类似于我的)。您的问题是您正在签署phonegap构建的调试版本。错误在那里:

Codesign check fails : ./build/page.app: code object is not signed at all
In architecture: i386

调试版本是i386二进制文件,因此它们可以在Mac上运行,但发布版本是ARM二进制文件。我不使用phonegap来进行构建,但是你需要构建Release版本才能签名。我在makefile中做了这样的构建:

ios-app:
        echo 'MAKE SURE YOU HAVE DONE security unlock-keychain login.keychain'
        cd $(ios_dir);xcodebuild -target $(app_name) -project $(app_name).xcodeproj -target $(app_name) -configuration Release CODE_SIGN_IDENTITY=$(sign_identity) CONFIGURATION_BUILD_DIR=`pwd`/build
        cd $(ios_dir);xcrun -sdk iphoneos PackageApplication $(ios_dir)/build/$(app_name).app -o $(ios_dir)/build/$(app_name).ipa -sign $(sign_identity) --embed $(cert_name)  -verbose

底线是您需要签署正确的包构建。