gpt4 book ai didi

xcode - 如何在 Swift 中编写构建前操作脚本?

转载 作者:搜寻专家 更新时间:2023-10-31 19:30:48 26 4
gpt4 key购买 nike

我已经从终端以及 Xcode 机器人的前/后触发器成功执行了 Swift 代码。但我正在努力为构建预操作编写 Swift 脚本。有人管理过这个吗?

这是我的预操作的样子:

enter image description here

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

/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 模块那么它就可以工作。 IE。 打印(“你好”)。但是我显然不能使用 NSProcessInfo

最佳答案

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

例子:

Edit scheme success

关于xcode - 如何在 Swift 中编写构建前操作脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31729018/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com