1

As part of an open source iOS testing framework I'm developing, I want to programmatically launch the Simulator with a given SDK. I want users of my framework to be able to identify an SDK by its canonical name, then my framework will launch the simulator using that SDK.

I know:

  • How to obtain the canonical names of all currently installed SDKs: xcodebuild -showsdks
  • How to obtain the developer root: xcode-select -print-path.
  • The file paths where recent versions of Xcode store their SDKs (the particular path below developer root).

But I don't know that future Xcode installations will put the SDKs in the same place relative to developer root. My testing framework currently makes assumptions about those paths, and those assumptions make me mildly nervous. I could require users to specify the full path to the SDK, but I'd like to be more friendly than that. Canonical names seem reasonably friendly (i.e., they are at least discoverable via a tool).

So: Is there a stable, reliable, programmatic way (e.g. an Apple-supplied command line tool) to identify the SDK root associated with a given SDK canonical name?

4

0 回答 0