How to write a string pre-action script in Swift?

I successfully executed Swift code from the terminal, as well as from pre / post-triggers from the Xcode bot. But I'm trying to write a Swift script to pre-create the assembly. Has anyone managed this?

This is what my preliminary action looks like:

enter image description here

When I build from the terminal ( xcodebuild -scheme UAT build ), I see the following errors:

 /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 ^ 

Update:
If I just print something without importing the Foundation module, it will work. That is print("Hello") . But I obviously can't use NSProcessInfo .

+4
source share
1 answer

The problem is that the --sdk for xcrun set on iPhoneOS when creating an iOS project. You need to explicitly specify --sdk macosx .

Example:

Change Scheme Success

+3
source

All Articles