Run swift script from Xcode iOS project as build phase

前端 未结 3 505
梦谈多话
梦谈多话 2021-02-01 05:20

Here is a simple swift script:

#!/usr/bin/env xcrun swift

import Foundation

let task = NSTask()
task.launchPath = \"/bin/echo\"
task.arguments = [\"farg1\", \"         


        
3条回答
  •  盖世英雄少女心
    2021-02-01 05:54

    When building for iOS the implicit SDK for xcrun is the iOS SDK, so you have the change it to the Mac OS X SDK with a command line parameter. Change the first line in your script to:

    #!/usr/bin/env xcrun --sdk macosx swift
    

提交回复
热议问题