xcode – 如何在Swift中编写构建预执行脚本?

前端之家收集整理的这篇文章主要介绍了xcode – 如何在Swift中编写构建预执行脚本?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已成功从终端执行 Swift代码,也从Xcode机器人的前/后触发器中成功执行.但我正在努力为构建预操作编写Swift脚本.有人管理过吗?

这就是我的预操作:

enter image description here

当我从终端(xcodebuild -scheme UAT构建)构建时,我看到以下错误

/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:10: note: while building module 'Darwin' imported from /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:  
#include <sys/types.h>  
^  
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "sys/cdefs.h"
^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/include/sys/cdefs.h:707:2: error: Unsupported architecture
#error Unsupported architecture
^

更新:
如果我只是打印一些东西而不导入Foundation模块那么它就可以了.即打印( “你好”).但我显然不能使用NSProcessInfo.

解决方法

问题是在构建iOS项目时,xcrun的–sdk选项设置为iPhoneOS.您需要明确说明–sdk macosx.

例:

Edit scheme success

猜你在找的Xcode相关文章