1、Xcode的archive菜单选项是灰色的

如果当前Xcode选择的设备是模拟器,那么"Archive"是灰色的,不能点。把当前设备设置成连接的真机设备或者默认的"iOS Device","Archive"会变成黑色。

2、选择自动签名时,证书报错

* has conflicting provisioning settings. * is automatically signed for development, but a conflicting code signing identity iPhone Distribution has been manually specified. Set the code signing identity value to "iPhone Developer" in the build settings editor, or switch to manual signing in the project editor. Code signing is required for product type 'Application' in SDK 'iOS 10.2'

解决:鼠标点击项目工程,然后在项目右边的Project Target中找到Build Settings然后搜索PROVISIONING_PROFILE删除所有包含PROVISIONING_PROFILE的项。

3、编译时脚本报错

/bin/sh -c /Users/apple/Library/Developer/Xcode/DerivedData/XXX-bcebrkpahigmkngytwmzustybhev/Build/Intermediates.noindex/ArchiveIntermediates/XXX-SIT/IntermediateBuildFilesPath/XXX.build/Release-SIT-iphoneos/XXX.build/Script-187F7F6921537B0600C427DD.sh
[14:59:47]: ▸ Updating build number to 20180920145946
[14:59:47]: ▸ Set: Entry, ":CFBundleVersion", Does Not Exist
[14:59:47]: ▸ File Doesn't Exist, Will Create: /Users/apple/Library/Developer/Xcode/DerivedData/XXX-bcebrkpahigmkngytwmzustybhev/Build/Intermediates.noindex/ArchiveIntermediates/XXX-SIT/BuildProductsPath/Release-SIT-iphoneos/XXX.app.dSYM/Contents/Info.plist
[14:59:47]: ▸ Command PhaseScriptExecution failed with a nonzero exit code

解决:在File==>Project Settings中把build system切换到 Legacy Build System

4、真机运行安装时报错

*.app does not contain a valid Info.plist, so it cannot be installed on iPhone 
“CFBundleExecutable” specifies a file that is not executable

解决:在targets=>build settings下搜索match-o type更改为executable。