xcode 带有 SDK 绝对路径的 xcodebuild 命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11133981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:39:14  来源:igfitidea点击:

xcodebuild command with absolute path to SDK

iosxcodecommand-linesdkxcodebuild

提问by Miroslav Kovac

I am using xcodebuildcommand line tool to build iOS app.

我正在使用xcodebuild命令行工具来构建 iOS 应用程序。

After instaling Xcode45-DP1it is automatically using 6.0 SDK from the new Xcode45-DP1 app bundle for building applications. There are 2 issues when submitting this app to AppStore.

安装Xcode45-DP1 后,它会自动使用来自新 Xcode45-DP1 应用程序包的 6.0 SDK 来构建应用程序。将此应用提交到 AppStore 时有 2 个问题。

  1. The app is now automatically built with latest SDK (6.0), which is note yet supported, so app cannot be submitted. SOLUTION: I copied the old-current SDK (5.1) to Xcode45-DP.app and in command line specified -sdk iphoneos5.1

  2. Second problem is that when ApplicationLoader is verifying app, is sees that SDK is used from unsupported version of Xcode (45-DP1) and rejects to upload app. SOLUTION: I would like to specify absolute path for SDK, like: xcodebuild -sdk /path/to/5.1sdk...

  1. 该应用程序现在使用最新的SDK(6.0)自动构建,注意尚不支持,因此无法提交应用程序。解决方案:我将旧的当前 SDK (5.1) 复制到 Xcode45-DP.app 并在指定的命令行中-sdk iphoneos5.1

  2. 第二个问题是,当 ApplicationLoader 正在验证应用程序时,发现使用了不受支持的 Xcode 版本(45-DP1)的 SDK 并拒绝上传应用程序。解决方案:我想为 SDK 指定绝对路径,例如:xcodebuild -sdk /path/to/5.1sdk...

The problem is that xcodebuild always says that SDK "/path/to/iPhoneOS5.1.sdk/" cannot be located.

问题是 xcodebuild 总是说找不到 SDK "/path/to/iPhoneOS5.1.sdk/"。

Does anyone have an experience with how to use absolute path to sdk and what file/directory should it point to?

有没有人对如何使用 sdk 的绝对路径以及它应该指向什么文件/目录有经验?

Thanks in advance.

提前致谢。

回答by chown

I have been searching for this for a while as well and there does not appear to be a direct way of getting the full absolute path to a specific SDK. However, if you set the -sdkswitch and -find-libraryfor an arbitrary library and strip the last few path parts off you can get the full sdk path like so:

我也一直在寻找这个,并且似乎没有直接的方法来获取特定 SDK 的完整绝对路径。但是,如果您为任意库设置-sdk开关并-find-library删除最后几个路径部分,您可以获得完整的 sdk 路径,如下所示:

[ 13:02 jon@MacBookPro ~ ]$ export SYS_ROOT=`xcodebuild -sdk iphoneos6.0 -find-library system`
[ 13:02 jon@MacBookPro ~ ]$ echo "${SYS_ROOT/\/usr\/lib\/libsystem.dylib/}"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk

[ 13:02 jon@MacBookPro ~ ]$ export SYS_ROOT=`xcodebuild -sdk iphonesimulator6.0 -find-library system`
[ 13:02 jon@MacBookPro ~ ]$ echo "${SYS_ROOT/\/usr\/lib\/libsystem.dylib/}"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk