Identify when the iOS simulator or SDK hasn't been installed
- Dominant language
- Python
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 40
Description
### Describe the bug
Briefcase will detect if Xcode is installed, and if it isn't, direct the user to the App Store to download it.
However, while a fresh Xcode install includes the macOS SDK, it doesn't include the iOS SDK.
### Steps to reproduce
1. On a machine with no prior Xcode install, install Xcode, but *don't* download the iOS SDK.
2. Create a new helloworld project
3. `briefcase create iOS`
Generates the following error:
```
[helloworld] Updating app metadata... xcode.py:393
Setting main module... started xcode.py:374
Setting main module... done xcode.py:374
xcode.py:396
[helloworld] Building Xcode project... xcode.py:396
Building... started xcode.py:397
subprocess.py:827
>>> Running Command: subprocess.py:827
>>> xcodebuild build -project '/Users/dyeaw/beeware-tutorial/helloworld/build/helloworld/ios/xcode/Hello World.xcodeproj' -destination subprocess.py:827
'platform="iOS Simulator"' -configuration Debug -arch arm64 -sdk iphonesimulator -quiet
>>> Working Directory: subprocess.py:827
>>> /Users/dyeaw/beeware-tutorial/helloworld subprocess.py:827
[09:55:33] --- xcodebuild: WARNING: Ignoring provided run destination because no scheme was passed. subprocess.py:195
[09:55:36] /* com.apple.actool.errors */ subprocess.py:195
/Users/dyeaw/beeware-tutorial/helloworld/build/helloworld/ios/xcode/HelloWorld/Images.xcassets: error: No available simulator runtimes for platform subprocess.py:195
iphonesimulator. SimServiceContext supportedRuntimes=[]
/* com.apple.actool.document.notices */ subprocess.py:195
/Users/dyeaw/beeware-tutorial/helloworld/build/helloworld/ios/xcode/HelloWorld/Images.xcassets:./AppIcon.appiconset/[][ipad][76x76][][][1x][][][][]: subprocess.py:195
notice: 76x76@1x app icons only apply to iPad apps targeting releases of iOS prior to 10.0.
/* com.apple.actool.compilation-results */ subprocess.py:195
/Users/dyeaw/beeware-tutorial/helloworld/build/helloworld/ios/xcode/build/Debug-iphonesimulator/Hello World.app/AppIcon60x60@2x.png subprocess.py:195
/Users/dyeaw/beeware-tutorial/helloworld/build/helloworld/ios/xcode/build/Debug-iphonesimulator/Hello World.app/AppIcon76x76@2x~ipad.png subprocess.py:195
/Users/dyeaw/beeware-tutorial/helloworld/build/helloworld/ios/xcode/build/Hello World.build/Debug-iphonesimulator/Hello subprocess.py:195
World.build/assetcatalog_generated_info.plist
subprocess.py:195
note: Run script build phase 'Install target specific Python modules' will be run during every build because the option to run the script phase "Based subprocess.py:195
on dependency analysis" is unchecked. (in target 'Hello World' from project 'Hello World')
note: Run script build phase 'Sign Python Binary Modules' will be run during every build because the option to run the script phase "Based on subprocess.py:195
dependency analysis" is unchecked. (in target 'Hello World' from project 'Hello World')
** BUILD FAILED **
```
### Expected behavior
Briefcase should, at the very least, detect that there is no iOS runtime available, and prompt the user to install it.
Ideally, it would also start the download of the iOS SDK; but this may not be possible to programmatically trigger.
### Screenshots
_No response_
### Environment
- Operating System: macOS
- Python version: All
- Software versions:
- Briefcase: 0.3.20
### Logs
_No response_
### Additional context
See beeware/beeware#458 for the original report/fix to the tutorial.
This is difficult to reproduce because once you *have* downloaded the iOS SDK, you'll never see this error again.
There might be a similar error when Xcode updates with a new iOS SDK (eg when a new iOS version is released). Downloading the iOS SDK a manual step there, too.
My initial guess is that the best approach will be to run `xcrun --show-sdk-path --sdk iphoneos` and check for error codes and/or the existence of the returned directory. However, I don't know exactly what this method returns if you *don't* have an iOS SDK installed.
Contributor guide
Assessment
This issue has not been assessed yet.