使用iphonesimulator SDK和macOSX SDK在Swift REPL中有什么区别?

3

您可以使用不同的选项来运行Swift REPL命令,以满足--sdk参数需求。您可以运行:

xcrun swift -v -sdk $(xcrun --show-sdk-path --sdk iphonesimulator)

或者
xcrun swift -v -sdk $(xcrun --show-sdk-path --sdk macosx)

还有一点需要注意:

xcrun swift -v -sdk $(xcrun --show-sdk-path --sdk iphoneos)

这似乎并不起作用,并且会引起很多错误。
使用iphonesimulator sdk和macosx sdk时,我的输出将有什么不同?

1个回答

4

桌面、设备仿真器和设备硬件是不同的构建目标:

SDK               目标
macosx            OSX桌面
iphonesimulator   iOS模拟器
iphoneos          iOS硬件设备

目前,xcodebuild支持这些平台:

 OS X           The local Mac, referred to in the Xcode interface as My Mac, and which supports the fol-lowing following
                lowing keys:

                arch  The architecture to use, either x86_64 (the default) or i386.

 iOS            An iOS device, which supports the following keys:

                name  The name of the device to use.

                id    The identifier of the device to use, as shown in the Devices tab of the Xcode
                      Organizer.

 iOS Simulator  The iOS Simulator, which supports the following keys:

                name  The full name of device to simulate, as presented in Xcode's UI.

                OS    The version of iOS to simulate, such as 6._, or the string latest (the default) to
                      indicate the most recent version of iOS supported by this version of Xcode.

这在IDE中是抽象的:

对于iOS,Xcode会根据您想要运行应用程序的位置自动切换iOS模拟器SDK和设备SDK。您不需要手动选择这些设置。

参考资料


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接