Simulator

RSS for tag

Rapidly prototype and test builds of your app during the development process using Simulator.

Posts under Simulator tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Resolving a "Simulator runtime is not available" error
Some Macs recently received a macOS system update which disabled the simulator runtimes used by Xcode 15, including the simulators for iOS, tvOS, watchOS, and visionOS. If your Mac received this update, you will receive the following error message and will be unable to use the simulator: The com.apple.CoreSimulator.SimRuntime.iOS-17-2 simulator runtime is not available. Domain: com.apple.CoreSimulator.SimError Code: 401 Failure Reason: runtime profile not found using "System" match policy Recovery Suggestion: Download the com.apple.CoreSimulator.SimRuntime.iOS-17-2 simulator runtime from the Xcode To resume using the simulator, please reboot your Mac. After rebooting, check Xcode Preferences → Platforms to ensure that the simulator runtime you would like to use is still installed. If it is missing, use the Get button to download it again. The Xcode 15.3 Release Notes are also updated with this information.
0
0
4.6k
May ’24
Xcode fails to attach to process when building to the Simulator
When trying to build and run our iOS app on the simulator we're hitting the following error: Could not attach to pid: "XXXXX" failed to get reply to handshake packet within timeout of 6.0 seconds I've included some more details on our project/setup below: We're working on a large project with multiple schemes / app targets. The error only affects one of our targets - however the dependencies between the problematic target and the others are very similar. The issue only affects building to the simulator; building to a physical device works fine. Scheme configuration is the same across all targets. We've faced this issue on multiple versions of Xcode, from 15.x through to the latest 16.3 RC. We've tried a number of workarounds, some of which work intermittently for some colleagues - but none of which have provided a durable solution. These include varying combinations of: Setting the IDEPreferLogStreaming=YES environment variable Unchecking Debug Executable under Edit Scheme -> Run Manually launching the app on the Simulator and then attaching the debugger using Debug -> Attach in Xcode Erasing all contents and settings on the simulator (this sometimes fixes things for a single build, but we run into the same issue again for all subsequent builds, and it doesn't work for all developers). Clearing out Derived Data and running a clean build (this doesn't seem to help). We'd really appreciate any input on how we can diagnose what's causing this issue or any suggested steps to help resolve it.
0
1
23
22h
URLSession is broken in iOS 18.4 RC Simulator
I'm seeing fully reproducible issues with URLSession on iOS 18.4 RC Simulator running from Xcode 16.3 RC. URLSession seems to get into a broken state after a second app run. The following sample succeeds in fetching the JSON on first app run but when the app is closed and ran again it fails with one of these errors: Error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." Error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." I'm wondering if this something related to my OS setup or is this due to internal URLSession changes in iOS 18.4. Already submitted as FB17006003. Sample code attached below: import SwiftUI @main struct NetworkIssue18_4App: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @State private var message: String = "" var body: some View { VStack { Text(message) Button("Try Again") { Task { await fetch() } } } .task { await fetch() } } private func fetch() async { message = "Loading..." let url = URL(string: "https://poetrydb.org/title/Ozymandias/lines.json")! let session = URLSession.shared do { let response = try await session.data(from: url) print("Response: \(response)") message = "Success, data length: \(response.0.count)" } catch { print("Error: \(error)") message = "Error: \(error.localizedDescription)" } } }
9
1
214
59m
iOS 18.3.1 - runtime vs version number
Not sure if this is common with releases but I've been doing some CI work recently so it's the first time I've seen this myself, When I list the runtimes installed on my machine: xcrun simctl list runtimes I notice the iOS 18.3.1 release has the below info: == Runtimes == iOS 18.3 (18.3.1 - 22D8075) - com.apple.CoreSimulator.SimRuntime.iOS-18-3 Meanwhile the other runtimes are listed as: == Runtimes == iOS 17.5 (17.5 - 21F79) - com.apple.CoreSimulator.SimRuntime.iOS-17-5 iOS 18.4 (18.4 - 22E5216h) - com.apple.CoreSimulator.SimRuntime.iOS-18-4 watchOS 11.2 (11.2 - 22S99) - com.apple.CoreSimulator.SimRuntime.watchOS-11-2 visionOS 2.3 (2.3 - 22N895) - com.apple.CoreSimulator.SimRuntime.xrOS-2-3 (Apologies for the weird formatting above, using code blocks and quote markdown condenses things down to one line for some reason) This is causing some funkiness in my CI code which I've managed to workaround, but wondered if this was a common thing, specifically the mismatch between the iOS name and the runtime version. iOS 18.3 and com.apple.CoreSimulator.SimRuntime.iOS-18-3 vs 18.3.1 - 22D8075 where the .1 has been dropped for the runtime names?
1
0
50
3d
Uncategorized (Xcode): Command ClangStatCache failed with a nonzero exit code
I'm encountering an issue while trying to build my iOS app in Xcode for the simulator. Issue: Xcode Version: 15.x macOS Version: 14.x (Sonoma) Simulator: iPhone 16 Pro Error Message: Command ClangStatCache failed with a nonzero exit code Steps Taken: Cleaned build folder (Shift + Cmd + K) Deleted DerivedData (rm -rf ~/Library/Developer/Xcode/DerivedData) Updated Xcode and checked iOS SDK updates Disabled Clang Static Analyzer Cache None of these steps resolved the issue. Any help would be appreciated! Thanks in advance.
0
0
28
1w
JournalingSuggestions Crashes on iOS 18 Simulator with Xcode 16.2 – Linker Error
I’m running into an issue while implementing JournalingSuggestions with Xcode 16.2 and the iOS 18 simulator. My code builds and runs fine on a physical device, but it consistently crashes on the simulator and in Xcode previews. I’ve tried several workarounds, including weak linking and solutions from this post (746843), but I’m still hitting a wall. Here’s what’s happening: I get a warning: JournalingSuggestions is not available when building for iOS Simulator. This is followed by a build error: Linker command failed with exit code 1 (use -v to see invocation). What I’ve Tried: Weak linking the JournalingSuggestions framework. Applying fixes from this post (746843), such as cleaning the build folder and using weak link. Deleting Derived Data and rebuilding. Testing on a physical device (works fine). My Setup: Xcode Version: 16.2 Simulator: iOS 18 Build Success: Works on physical device, fails on simulator/preview Code: #if canImport(JournalingSuggestions) import JournalingSuggestions #endif ... var suggestionButton: some View { #if canImport(JournalingSuggestions) #if !targetEnvironment(simulator) if #available(iOS 17.2, *) { return AnyView(journalingSuggestionsPickerButton) } #endif return AnyView(disabledSuggestionButton) #else return AnyView(disabledSuggestionButton) #endif }
1
0
213
2w
Settings.bundle
Hello everyone, I have added a Settings.bundle to my Xcode project, but it does not appear in the iOS app settings. The file is correctly copied into the target, but nothing shows up in the settings. I have already checked and tried several things, but without success. What I've tried so far: Ensuring that Settings.bundle is included in the project: Settings.bundle is listed under Build Phases → Copy Bundle Resources. Checking the structure of Root.plist: The file exists and has the following structure: Checking the structure of Root.plist -it has Checking if the file is included in the app -it is Restarting the simulator and reinstalling the app I reset the simulator and reinstalled the app completely, but the issue persists.
3
0
260
3w
Failed to prepare device
We are getting unreliable results on XCode Cloud tests. I'm not sure if it's related to the current service outage. I'm running a very simple XCTest UI suite, on some devices it succeds and it others it fails to start. I'm not getting a userful error message. MyApp-Runner encountered an error (Failed to prepare device 'iPhone 16 Pro Max' for impending launch. (Underlying Error: Unable to boot the Simulator. launchd failed to respond. (Underlying Error: Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding)))
4
5
478
3w
XCode Components fail to download
Summary: XCode components (eg. iOS Simulator Runtime, tvOS Simulator Runtime, predictive code completion model) fail to download / install. I have tried to self-service this issue as much as possible before posting. Description of Problem: In XCode, I am unable to install predictive code completion model. The attempts fail with error Failed - There was an error transferring over the network. and details: The operation couldn’t be completed. (IDELanguageModelKit.IDEModelDownloadAdapter.(unknown context at $11c762764).DownloadError error 2.) Domain: IDELanguageModelKit.IDEModelDownloadAdapter.(unknown context at $11c762764).DownloadError Code: 2 User Info: { DVTErrorCreationDateKey = "2025-02-27 16:12:31 +0000"; } -- There was an error transferring over the network. Domain: IDELanguageModelKit.IDEModelDownloadAdapter.(unknown context at $11c762764).DownloadError Code: 2 -- System Information macOS Version 15.3.1 (Build 24D70) Xcode 16.3 (23748.10) (Build 16E5104o) Timestamp: 2025-02-27T08:12:31-08:00 The simulator runtimes fail with this, different, error Failed - download failed and details: Download failed. Domain: DVTDownloadableErrorDomain Code: 41 User Info: { DVTErrorCreationDateKey = "2025-02-27 16:27:04 +0000"; } -- Download failed. Domain: DVTDownloadableErrorDomain Code: 41 -- Failed fetching catalog for assetType (com.apple.MobileAsset.iOSSimulatorRuntime), serverParameters ({ RequestedBuild = 22E5200m; }) Domain: DVTDownloadsUtilitiesErrorDomain Code: -1 -- Download failed due to not being able to connect to the host. (Catalog download for com.apple.MobileAsset.iOSSimulatorRuntime) Domain: com.apple.MobileAssetError.Download Code: 60 User Info: { checkNetwork = 1; } -- System Information macOS Version 15.3.1 (Build 24D70) Xcode 16.3 (23748.10) (Build 16E5104o) Timestamp: 2025-02-27T08:27:04-08:00 These specific error details are from the newest XCode-Beta, but the same issue persists with XCode. Troubleshooting already performed: I have tried uninstalling + reinstalling XCode and XCode-beta several times. I have tried deleting ~/Libraries/Developer multiple times I believe I am logged into XCode and OSX with my developer Apple account. Not sure how to verify if XCode is using this account during the download attempt. I have tried reinstalling OSX. Previously it was stuck at 15.0.0, but reinstalling got the newest minor+revision version to 15.3.1. I have followed the manual steps: https://developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components I am able to manually download the components components from Apple Developer Downloads: https://developer.apple.com/download/all/ (The download works and is quick, so I don't believe this is a network issue) There is PLENTY of drive space available (eg. 100s of GBs) As this is a laptop, I tried disabling energy saving mode. It is running on AC power. Additional Relevant facts: Very strangely, I was able to download an iPhone 16e supplemental component Network adapter: WiFi. Internet connection: Comcast / XFinity cable DNS resolver: tried using default for my network and tried switching to other public DNS including 1.1.1.1, 8.8.8.8 I tried looking in Settings > Privacy and Settings, Settings > Network for app-specific permissions / firewall settings, but I don't believe any are applied. I'm not running sudo when I start up XCode.
1
0
298
4w
There is no way to test iOS 17-compatible app in a simulator?
The only iOS 17 target available in Xcode 16.2's build settings appears to be iOS 17.6. But there are no simulators (at least that I can find) with anything beyond iOS 17.5. Therefore you can't test on iOS 17 with a simulator, because none will show as a deployment target. What is the expected course of action here? I'm sure there are many cases where developers need to test on iOS 17, but in mine I need to test the new framework for accessing a user's contacts; it has changed significantly, and I need to make sure it degrades gracefully on iOS 17. I'm not inclined to make my application inaccessible to 20% of the user base.
2
0
315
4w
Sign in with Sandbox account in Xcode Simulator
Hello! I'm working on implementing SwiftUI + StoreKit2 IAP in my app, and Xcode testing has been fantastic, now I'd like to test my app with Sandbox, where I created a Sandbox account, and it works on my physical device, I can log in, make transactions, etc. (btw, feedback: please improve the UX for Sandbox testing, it's really clumsy compared to Xcode testing with Transaction Manager) My problem is that when I'd like to log in with my Sandbox account on the simulator (Settings -> Developer -> Sandbox Apple Account (at the bottom) -> Sign in), it doesn't work, it fails silently. I know it authenticates well, because if I type in the wrong password, I get an error popup, but with the right password, it just fails silently, hides the login sheet and the "Sign in" text remains "Sign in" (on my phone when I log in, the "Sign in" is replaced with the email address of the Sandbox account). I know many people get errors, and they recommend to go icloud.com and acccept TOS (done that), also to download the latest iOS for the simulator (also done), these are not a problem for me, as I don't get any errors. My authentication works, but for some reason the simulator still won't log in, it fails silently, and I see no errors/reason why. Tried with different simulators (latest iOS version), same result, tried to reboot the simulator, same result. Any idea why is this happening? Thank you, sendai
1
1
301
2w
Metal: Non-uniform thread groups unsupported in Simulator? Is it?
My app is running Compute Shaders that use non-uniform thread groups. When I run the app in the debugger with a simulator target the app crashes on encoder.dispatchThreads and the error message is: Dispatch Threads with Non-Uniform Threadgroup Size is not supported on this device. Previously the log output states that: Metal Shader Validation is unsupported for Simulator. However: When I stop the debugger and just run the app in the simulator without the debugger attached, the app just runs fine and does not crash. The SwiftUI Preview that also triggers the Compute Shader when preparing data also just runs fine without a crash. I can run and debug on a real device no problem - I just don't have all sizes available. Is there anything I need to check in my lldb/simulator configuration? It obviously does work, just the debugger cannot really deal with it? Any input would be nice as this really slows my down as I have to be extremely careful when debugging on the simulator.
2
0
452
2w
Simulator Location Authorization Issue: Authorization Status Remains notDetermined After Denying and Changing in System Settings
Hello everyone, I'm encountering a strange location authorization issue in the iOS simulator, and I'm hoping someone can help me analyze it. Problem Description: When my app runs for the first time in the simulator, it requests location permissions. I select "Deny" for the authorization. Then, I go to the simulator's "Settings" -> "Privacy & Security" -> "Location Services" and enable location permissions for my app. However, when I return to the app, CLLocationManager.authorizationStatus still returns .notDetermined, and the authorization request pop-up does not appear again. This issue persists even after resetting the simulator settings multiple times. import CoreLocation @Observable final class LocationManager: NSObject, CLLocationManagerDelegate { var locationManager = CLLocationManager() var currentLocation: CLLocationCoordinate2D? override init() { super.init() locationManager.delegate = self } func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) { let status = manager.authorizationStatus print("Authorize Status: \(status)") switch status { case .authorizedWhenInUse, .authorizedAlways: locationManager.startUpdatingLocation() case .denied, .restricted: stopLocation() case .notDetermined: locationManager.requestWhenInUseAuthorization() print("Location permission not determined.") @unknown default: break } } func requestLocation() { let status = locationManager.authorizationStatus if status == .authorizedWhenInUse || status == .authorizedAlways { locationManager.requestLocation() } else { locationManager.requestWhenInUseAuthorization() } } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { guard let newLocation = locations.first else { return } currentLocation = newLocation.coordinate print("Updated location: \(newLocation.coordinate)") } func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { print("Location update failed with error: \(error.localizedDescription)") currentLocation = nil } func stopLocation() { locationManager.stopUpdatingLocation() print("Stopped updating location") } }
0
0
366
Feb ’25
Unable to download latest version of iOS simulator
Hello, When trying to download the latest version of iOS simulator on xCode i get this error: Download failed. Domain: DVTDownloadableErrorDomain Code: 41 User Info: { DVTErrorCreationDateKey = "2025-02-21 09:05:50 +0000"; } Download failed. Domain: DVTDownloadableErrorDomain Code: 41 Failed fetching catalog for assetType (com.apple.MobileAsset.iOSSimulatorRuntime), serverParameters ({ RequestedBuild = 22D8075; }) Domain: DVTDownloadsUtilitiesErrorDomain Code: -1 Download failed due to a bad URL. (Catalog download for com.apple.MobileAsset.iOSSimulatorRuntime) Domain: com.apple.MobileAssetError.Download Code: 49 User Info: { checkConfiguration = 1; } System Information macOS Version 15.0 (Build 24A335) Xcode 16.2 (23507) (Build 16C5032a) Timestamp: 2025-02-21T11:05:50+02:00
1
0
216
Feb ’25
Inconsistent behavior across different test environments and simulators
I'm working on Apple Watch UI tests and have noticed different results between local and Xcode Cloud environments. I tested all cases locally, and they worked fine. However, when running the tests on Xcode Cloud, some issues caused them to fail: The test requires clicking a button to display the built-in keyboard, but on Xcode Cloud, the keyboard never appears, no matter how long I wait. The app unexpectedly closes during testing, displaying the error message: "Failed to launch application {Your app} is not running." These failures occurred on two different simulator destinations (Ultra 49mm 11.2 / Series 7 45mm 11.2) and can only be reproduced on specific simulators. Has anyone encountered a similar issue?
1
1
380
Feb ’25
App Tracking Transparency permission request iPadOS 18.3.1.
I implemented AppTrackingTransparency framework but Apple is rejecting the review because it seems the request is failing on iPadOS 18.3.1. which seems rare since it is working on all other devices. Has anyone faced the same issue? I have tested this in a physical iPhone with IOS 18.3.1 and in several devices using Xcode runtime simulator including iPad and iPhone in different IOS versions up to 18.2 (which I understand is the latest available in Xcode). The problem is that 18.3.1 runtime simulator is not available yet. Does anyone have more information when it will be available or what to do in these cases?
5
2
812
Feb ’25
Error Simulator Download Simulator IOS 18.2 22C5142a
I can't install Simulator 18.2 I reinstalled sometimes Xcode y always return this erro Download failed. Domain: DVTDownloadableErrorDomain Code: 41 User Info: { DVTErrorCreationDateKey = "2025-02-15 15:41:39 +0000"; } Download failed. Domain: DVTDownloadableErrorDomain Code: 41 Failed fetching catalog for assetType (com.apple.MobileAsset.appleTVOSSimulatorRuntime), serverParameters ({ RequestedBuild = 22K5148a; }) Domain: DVTDownloadsUtilitiesErrorDomain Code: -1 Download failed due to a bad URL. (Catalog download for com.apple.MobileAsset.appleTVOSSimulatorRuntime) Domain: com.apple.MobileAssetError.Download Code: 49 User Info: { checkConfiguration = 1; } System Information macOS Version 15.2 (Build 24C101) Xcode 16.2 (23504) (Build 16C5023f) Timestamp: 2025-02-15T09:41:39-06:00
4
0
686
3w