Xcode - iOS Simulator window is blank - ios

I'm running the latest version of macOS Big Sur with Xcode 12.2 beta 3. I build my app for the simulator and it succeeds - but the simulator screen is blank. The same thing happens when I go through the menus and open Simulator manually - Xcode > Open Developer Tool > Simulator. I have tried adding a new simulator device, and running xcode-select --install.
Preferably, I would rather not have to re-install Xcode as I have limited space and would have to juggle other applications, use an external hard drive etc (I have a 128GB MacBook Air).
This is what appears when I try both methods.

I determined the problem.
There was a bug in the developer beta version I was using.
It was causing the simulator to fail to launch correctly.
I have reported this bug to Apple through Feedback Assistant, and moved to a stable version of Xcode which is now working with the simulator.

I agonised over this for ages since I moved to the MacPro M1.
App run fine on connected fysical IOS device but not in emulator...
Upgrading MacOs and Xcode fixed nothing...
Was finally on MacOS 12.3.1 and Xcode13.3.1 when I figured it out.
The only thing that finally actually worked was removing the check to run Xcode with Rosetta and to be sure downloading a new IOSXXX simulator.
Go to Applications -> right click on Xcode --> Get info --> uncheck Open using Rosetta.
Hope it helps for you!

Related

Xcode error: Failed to prepare device for development

I have updated to Xcode 12.3 beta. device version is 14.2, but Xcode complaining:
Errors were encountered while preparing your device for development. Please check the Devices and Simulators Window.
Failed to prepare device for development
iPhone directly connected to MacBook.
I have tried all mumbo jumbos on the web. but no success any idea?
Unable to prepare DEVICE for development
Please check the connection to the device, and review all errors in the Devices and Simulators window.
A simple phone restart will fix it
I have had to come back to this SO question twice in the past couple weeks. First time, I did have to update my Xcode and iOS versions, which fixed the issue. Now, the issue has returned, but there are no updates. I tried disconnecting and reconnecting my phone from my laptop, but to no avail.
What fixed it the second time was merely restarting my phone. I am curious if that would have fixed it the first time too, without needing to have updated.
I know this is just echoing the other answers here, but at the very least, I would recommend just starting with a simple phone restart and seeing if that fixes your problem. Here is the specific screenshot that I encountered, in case yours is the same (pro tip: you can open up the "Devices and Simulators" window by going to Window -> Devices and Simulators shift-command-2).
This error shows because of iPhone OS version is not supported by Xcode that's why this warning popped up, so check which max ios version is supported by Xcode which you are using.
In my case, the Xcode version is 13.1 and my iOS version is 15.4 so what I did, First downloaded device support version 15.4 from here (Download according to your device version) and added this to my Xcode.
steps to add the file in Xcode:-
Go to Applications > Right click on Xcode and Select Show Package Contents > Contents > Developer > Platforms > iPhoneOS.platform > DeviceSupport.
Extract your device support file to DeviceSupport Folder.
Restart Xcode and unplug and plug in your device.
Exact same problem here, this solved the issue for me:
Delete the app from the phone
Clean the Build Folder with: ⌘ + shift + K
Delete derived data
Unpair device (from ⌘ + shift + 2 window)
Disconnect iPhone
Restart iPhone
Restart Mac
Trust
After this, it worked for me.
I restarted my iPhone(14.2); now both Xcode 12.3 beta and 12.2 can run app on my device.
I could not get the phone to authorize until I had the paired Apple Watch trust the computer as well.
A more helpful error message could be imagined.
Both the iPhone and the paired Apple Watch must trust the computer before the phone can be successfully prepared for development.
If u are looking this because, your ios 15.7 device (latest for iPdas at the moment) show this error on xcode 14.0 (latest at the moment) it is a bug related with the xcode version.
Check Here.
Update
This issue is fixed in Xcode 14.0.1
In my case was to keep the iOS version with my Xcode version in sync.
Xcode 12.3 with iOS 14.3
What worked for me was to go to Xcode Devices and Simulators window, then ...
right click on the Connected device, and select "Show Provisioning Profiles" menu item, then delete all the provisioning profiles,
right click on the Connected device, and select "Unpair Device" menu item
Unplug and reboot the phone
I tried most suggestions here. The only thing that ended up working was unpairing my phone in Xcode then unpairing my apple watch from my iPhone. Connects just fine now. iOS (14.3) Xcode (12.3)
Thanks Matt for hint:
Updating device iOS to 12.3 beta fixed the problem.
if you updated you iOS to latest beta version, you should also use latest Xcode beta version.
Exact the same problem with Xcode 12.3 beta ; for me, just have to:
Disconnect the phone
Restart the phone still on ios14.2
-> data cable off
-> data cable on
and it works :)
Solution: Update your Xcode to a newer release date than your iOS Release Date.
I experienced this problem when using the iPhone's personal hotspot on my Mac. The fix was to disconnect the phone from the computer, then disconnect from the personal hotspot and reconnect again. Apparently this makes the mac use the wifi hotspot (and not the usb hotspot on the iPhone, which messes things up when debugging).
As many people mentioned/suggested, restarting my iPhone solved the problem.
My setups are: Catalina 10.15.7, Android Studio 4.0, Flutter 2.01,and Xcode 12.4.
I think having an apple watch paired to your iphone causes some issues.
I had trusted from my apple watch, but was still having this issue. Unparing my apple watch from my iphone was the only thing that worked for me:
unpair apple watch from iphone
unpair iphone from xcode
Restart both, and don't pair apple watch until the iphone is paired.
and, if you have any other problems, and are using flutter, run flutter doctor, and ensure you have cocoapods installed.
and once again, if Flutter issues, follow the details here to ensure you have your signing setup correctly
also, if things aren't working, then do a flutter clean, and then try again.
Updating Xcode is a fix because old versions of Xcode can't talk to new versions of iOS (see https://developer.apple.com/support/xcode/ for compatibility).
If you're stuck on an old version of Xcode you can use something like https://github.com/iGhibli/iOS-DeviceSupport or https://github.com/filsv/iPhoneOSDeviceSupport which installs the newer device support files into older versions of Xcode.
I just solved my issue removing the iPhone cable and putting it back.
This solved the issue for me:
Delete the app from the phone
Clean the Build Folder with: ⌘ + shift + K
Unpair device ⌘ + shift + 2
Disconnect iPhone
cmd + shift + 2
Click the red cross to check error detail
In most cases, the error message shows your xcode supported iOS version is lower than your iPhone's iOS version.
Update your xcode.
In my case, after updating iPhone to a newer iOS version then got this issue.
The solution is needed to update XCode to the latest version and everything is ok.
If other answers don't work, try updating Xcode.
For me I was using Xcode 14.0.0. The release notes for 14.0.1 say
This update fixes an issue that prevents development with devices running iOS 15.7.
Indeed my phone is on iOS 15.7.
Nothing from the above listed helped me and also I have encountered this problem when the app was removed for a while. But turning off the phone for 10 mins solved the problem.
My Current Setting and Versions:
XCode 12.4 and iOS 14.4
I had to update XCode since my iOS was updated. This fixed the compiler error in Unity and then the same message popped up during deployment. All I did was disconnect/re-connect.
Restarting the iPad works for me every time!
We encountered this error and determined it was due to a damaged iPhone cable. New cable, problem solved.
I just had to unpair the phone from Xcode's Devices and Simulators screen and then tap Trust when connecting it to the computer to make my Watch work with Xcode
I had to change the iOs Deployment target to "iOs 15". Then it worked. After that, I just set it back to iOS 12, and everything keeps working.
If nothing worked for you, try the below steps.
Update the Xcode
Update the iOS version
Connect mac and iPhone to the same wifi
just Clean the Build Folder with: ⌘ + shift + K

dyld_shared_cache_extract_dylibs failed for iPhone XS Max running ios 12.1.2

I am trying to run my app on iPhone XS Max running iOS 12.1.2, but till the end of the build and it returns "dyld_shared_cache_extract_dylibs failed" , i removed the supported files for it and rerun my app and it gives the same error , any suggestions i'm stuck ?????
There is a (temporary) solution I've been using...
Open Devices and Simulators
Remove your device from the list
Tap the + button on the bottom left of the window
Select the device (before tapping Trust on it)
Tap Trust on the device
Profit
For me I still have to do this steps every time I connect the device...
I have both Xcode10.3 and Xcode11.2.1 installed on same machine. Whatever solution I try, it doesn't work with Xcode10.3 and iPhone11. It works like a charm on the latest Xcode though. I think the solution is to switch to the latest Xcode version.
I recently solved this issue by installing Xcode 11.2 and 10.1 alongside each other, and using Xcode 11.2 to build the debugger files. It seems 10.1 can't handle newer versions of iOS and builds the debugger support files incorrectly.
Delete everything under ~/Library/Developer/Xcode/iOS DeviceSupport/ related to the version of iOS giving you trouble. This is where Xcode saves the debugger support files. Then launch Xcode 11.2 with the phone connected and allow it to build the debugger support. After it has finished, close it and open Xcode 10.1 and it should work.
i tried everything and my solution was go to app store and download again xcode, he is going to updated by self
try Run it in latest Xcode version then try again in the version you want
and try to reboot the mobile device and unpair it and connect it again thats worked for me
BTW thanks #unstablerealtiy

Xcode 9 iOS Simulator becoming black screen after installing Xcode 10 beta

I know that so many people have asked this question earlier. But I think my situation is different. In my case Xcode 9.2 was already installed and I upgraded macOS from 10.13.2 to 10.13.5. Then I installed Xcode 10 beta. Now when I'm running any project on Xcode 9.2 and try to use simulator, its becoming black though I can see the xcode logs. Things I have tried so far,
Uninstalled Xcode 10 Beta
Uninstalling & reinstalling Xcode 9.2
Uninstall Xcode 9.2 and install Xcode 9.4
Reset Content & Settings from simulator menu
Restart Device from simulator menu
Resizing simulator.
Followed this post and cleaned DerivedData, CoreSimulator, iOSDeviceSupport
Re add simulators from devices & simulators section
Now what should I do now?
Try running defaults write com.apple.CoreSimulator.IndigoFramebufferServices FramebufferRendererHint 3 in Terminal (source). Note that this will force Simulator to use OpenGL instead of Metal, so you'll want to re-run it with 0 once this gets fixed.
try workaround, delete Library/Developer folder and start it again
Another option that occurred for me. I subclassed UIWindow and called .init(frame: .zero). Changing to .init(frame: UIScreen.main.bounds) fixed it.
Open up XCode 9 and go to add additional simulators(pictured below) re-add iOS 10 and iOS 11 simulators
You seem to have tried everything except changing the iOS simulator version you are trying to run.
Maybe the problem lies with that specific version of iOS simulator eg. iOS 11.x iPhone 6. Change that and it may run OK.
If you do not have desired version with you, go to XCode->Preferences->Components, and download one of the older iOS simulators available at the time of XCode 9.x.
Then, go to XCode->Windows->Devices and Simulators. Press + sign at the bottom left of the screen. Add your desired simulator version (give your desired name), so that this newer simulator appears in runnable scheme list of XCode.
This is just for the users that failed trying everything to save Xcode 10 and then reinstalled Xcode 9.4.1 and the simulator still not working.
Here is what I did to give Xcode 9.4.1 back running.
After I got this problem after upgraded to Xcode 10.
I tried that famous FramebufferRendererHint, didn't work for me.
I have found out the Xcode 10.1 beta release didn't fix the problem for someone else, so I didn't bother to try 10.1 beta.
From the online research I know the problem is in /Library/Developer/PrivateFrameworks/CoreSimulator.framework.
Without Xcode even installed on your Mac /Library/Developer doesn't exist.
So it is installed by Xcode when your first time run Xcode. You would notice a screen showing "Installing Components"
But after you installed Xcode 10 and then install/run Xcode 9.4.1 it won't touch that folder anymore. So problem stays even you put Xcode 9.4.1 back
That's why after I downloaded Xcode 9.4.1 expanded and ran it. Problem still there.
I didn't backup my Mac. So I decided to start from scratch. Restored my MacBook from Internet, downloaded Xcode 9.4.1 again. and now everything is back to normal.
I can keep releasing the App to App Store now.
In my case (xcode 10), I just left the computer for 10 minutes or so (out of frustration!) and when I came back I found it at the starting screen! .... I guess for the first time it takes time

How to fix Xcode "DTAssetProviderService could not start.." error?

I have upgraded macOS Sierra Developer Preview, but my Xcode 7.3.1 gives below error while try to run my project on simulator. In addition Generic to archieve gives another error like:
In addition for archive: a cryptographic verification failure has occured.
How can I fix this?
I have tried before Xcode 8.0 Beta, uninstall it deleting derivedData and reset content simulator but still occurs this error.
Update:
I want to share an information who want to use Sierra now. If you decide to do below changes you need to know "Uploading App Store with beta software" not allowed by Apple. Continue with El Capitan and Xcode 7.3.1 for production.
If you want the slow solution, you can reinstall Xcode 7.3.1 by downloading it from https://developer.apple.com/download/more/.
It worked for me and now my Simulator is able to start again without getting the error.
The issue is discussed in depth here:
How to fix Xcode "DTAssetProviderService could not start.." error?
This seems to be a major bug. Until Apple fixes it, you can work around it:
Build app
The app will still install on the simulator, even with the error
Launch the app manually on the simulator
Go to Xcode
Click Debug > Attach to Process > Your App Name
That will enable Xcode debugging features and allow your app to run in simulator. Definitely not ideal, but hopefully you can use this until a real solution comes out.
This is a regression in macOS Sierra that multiple developers have reported in the forums and in the lab sessions at WWDC. Xcode 7.3 is not supported on Sierra. If you want to use macOS Sierra, please use Xcode 8.0 beta or later.
If you must use Xcode 7.3 on Sierra, you can partially workaround this bug by using Xcode.app to install the app through Build & Run, launch the app suspended from the command line (xcrun simctl launch -w booted <app identifier>) and then attach with the debugger and resume the suspended process.
Note that this issue only impact Xcode 7.3.1 downloaded from the Mac App Store. You will not hit this issue if you use Xcode downloaded from http://developer.apple.com (ie, the "drag & drop installer"). Note that you might hit another issue with the same symptoms when using the drag & drop installer. That is discussed in DTAssetProviderService could not start DTXConnection with Simulator
You can still run the debugger, but you have to attach it manually.
You can run your app tapping the icon in the simulator, than switch back to Xcode and select Debug, Attach to Process and pick your app process.
The following steps fixed the issue for me:
Remove both Xcode 7.3.1 and 8 Beta
Remove /Library/Developer and ~/Library/Developer (before removing check the contents and back up whatever you need)
Download the Xcode 7.3.1 DMG file and the Xcode 8 Beta xip file (unless you already have them)
Install 7.3.1 and test the Simulator (should work fine now)
Install 8 Beta and test the Simulator in 7.3.1 again (should work as before)
Restore what you backed up on step 2

Xcode beta 6 iOS 8: Simulator not working

I cannot launch the simulator successfully. Once I launch the IOS Simulator this error appears:
"Unable to boot the IOS Simulator."
Following the IOS Simulator error, I then get an error from Xcode reading:
Unable to run app in Simulator
An error was encountered while running (Domain = DTiPhoneSimulatorErrorDomain, Code = 2)
UPDATE:
This might sound silly but I went to Xcode/preference/Downloads with intentions of seeing a IOS 8.0 Simulator but there was none. Could this be the problem? Am I suppose to have a IOS 8.0 Simulator? If so can someone direct me how to get it? Also, under the "Downloads" tab in Xcode preference I do see IOS 7.0 and 7.1 Simulators and both work fine with Xcode 5.
the trick is, to select the right command line tools!
just select it here
reboot(!) and everything is fine again :-)
Ok It's known problem. Do you see simulators list? If not
Goto Xcode Menu -> Open Developer Tool -> It will open a simulator in your Dock -> click on simulator then go to Simulator Menu: Hardware -> Device -> Manage Devices. Add needed simulators. Always try to run your app with different simulators.someone will work.
Restart your Mac. I just had that exact error after installing Xcode 6 beta 7, literally the only thing I did in response was reboot my Mac and now the iOS 8 simulator is working.
This error is common if you update Xcode without restarting afterwards.
In my case, i reset ios simulator settings fix it.
iOS Simulator -> Reset Content and Settings ...
Open Xcode 6 beta
Goto Window > Devices
Click on the little + sign at the bottom
Add (if missing) all the devices that you want, or delete and recreate if not working.
If anyone of the simulator is not working then you can delete it and then re-create it again in this menu.
I saw the same issue when I installed Xcode 6 beta 6, and deleted beta 4 and beta 5. Apparently, deleting the old betas also deleted the iOS Simulator 8 versions! Putting it back from my Trash solved the issue.
Solution: Don't delete old beta software!
Edit: #Flori's solution worked. Was able to delete the old beta software, and after a complete system reboot, it worked again.
From the xCode 6 pull down menus, Xcode > Open Developer Tool >
iOS Simulator (if you get a pop up error just dismiss it)
Once in the Simulator go to Hardware > Device > Manage Devices.
Delete everything listed under simulator.
Reboot your machine.
After that, navigate back to Manage Devices in the simulator and click the plus to add back your simulators. Then the iOS 8 simulators will show up.
Just unset DYLD_INSERT_LIBRARIES environment variable in the /etc/launchd.conf or ~/.launchd.conf file. Which you can edit by sudo vi /etc/launchd.conf command. remove the above flag save it by "ZZ" (captial Z) and reboot the system. It works like a charm.
Make sure that path in menu XCode>Preference>Locations point to XCode 6.0 (Restart Xcode after changing them). Then go to menu Window>Devices and add simulator devices you want to use.
Edit: Turns out I was getting my version of the error because I had a file (the "Empty File" type) named "Frameworks" in several of my projects, and this was causing big issues with the iOS 8 simulators. Renaming the file to be anything else, and then doing a Clean Build Folder fixed it right away.
------Deprecated Original Message Below--------
In case this helps anyone -- I was having a similar error on Xcode 6 GM, and tried everything mentioned in these Answers, but the iOS 8 simulators would never run any of my apps (no problems with iOS 7 running from Xcode 6 though).
What did sort of work was creating a new project (new project apps would run in the iOS 8 simulators, but never any luck with existing apps). Copying over files and project settings is no fun, but at least it let me do testing and see if my apps needed fixing for the iOS 8 public release.
Extended description of problem at https://devforums.apple.com/thread/246751
I tried everything mentioned above and nothing worked.
Finally the only way to make it work was unsetting DYLD_INSERT_LIBRARIES=/usr/lib/libimckit.dylib
How I did this:
Open terminal and typing "sudo vi /etc/launchd.conf"
Changing
"setenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib"
to
"unsetenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib"
Save changes
Reboot your system
In this post [1] explain what DYLD_INSERT_LIBRARIES is for
[1] https://stackoverflow.com/a/26053165/2091181
I got this issue when moving from Beta 6 to Beta 7. Very frustrating. I could reset content and settings on any of the iOS 8 simulators. None of my iOS 8 simulators were working at all, just a black screen. I restarted my machine during the process, but I am not sure if it did anything. Initially I had only iOS 8 Simulators. I had to remove and reinstall Xcode6Beta7. I did not get the Install More Components the first time I installed it, I am not sure if that was the missing part. I installed the iOS 7 Simulators from Settings->Downloads because my iOS8 ones were not working. After I had reinstalled and relaunched the simulator, I then had a list of iOS 6,7,& 8 simulators. None of the iOS 8 Simulators were working. I was able to launch the iOS7 simulator and then using the device menu change to an iOS 8 Simulator. Some still did not work, I had to remove them and re-add them in the devices screen.
Remove XCode6Beta from Applications.
Restart Machine (Just in case, this seems to solve some peoples issue completely)
Install XCode6Beta.
Verify the Install Additional Components ran.
Launch Xcode6Beta.
Preferences->General->Change Command Line Tools to Xcode 6.0.
Restart Xcode.
Preferences->Downloads->Download iOS 7 Simulator (If not already downloaded).
Run App on iOS 7 Simulator (Or launch iOS Simulator and switch to iOS 7 device)
If the iOS 7 Simulator is working, Hardware->Devices->Select an iOS 8 simulator.
Delete and recreate any non working iOS 8 Simulators in Window->Devices from Xcode.
I wrestled with this for a bit, with the simulator app reporting that it couldn't find the iOS8 simulator, and suggesting updating in Prefs/Downloads, which didn't work. I tried re-installing Beta 6 twice (without removing all the support files, which would have been next). The initial installation described itself as build 6A280c; a fresh download yielded build 6A280e. No luck.
Eventually, I opened Window -> Devices, and used the "+" button in the lower left to add a new simulator for iPhone 5s, iOS 8, naming it "Fresh 5s". The Schemes popup now displayed three iPhone 5S/iOS 8 options (none with the name I designated, but differentiated by UUIDs); at least one of them worked.
I'm guessing that this feature (collections of arbitrary simulator instances) will be very useful when it's baked. In the meantime, I guess I'll need to manage the list of simulators manually.
Do following steps worked for me:
1. Launch the iOS Simulator and go to iOS Simulator --> Reset Content and Settings...
2. Close all the applications and restart your mac
3. Open Xcode6.0.1 or 6.0 and test the iOS Simulator
Had the same problem after moving from Xcode 6 beta 5 to beta 6, but also for the iOS 7.1 simulator. Restarting my machine seemed to do the job. I did not need to update from Xcode 5.1.1 CLT to Xcode 6.0 CLT.
I tried all of the solutions above, and was still unable to launch the iOS8 Simulator. The iOS7 Simulators all launched fine.
Looking at the Console, I found that the launch was crashing, and the crash log complained about the dynamic library, libimckit.dylib. You can read about that here:
https://discussions.apple.com/thread/5781366?start=0&tstart=0
The quick solution, remove that and its partner library, reboot, and it loads.
Is there anything interesting in ~/Library/Logs/CoreSimulator/CoreSimulator.log?
The "Unable to boot the iOS Simulator." error message is almost always because launchd_crashed because DYLD_INSERT_LIBRARIES was set to something not compatible with the iOS Simulator runtime. Do you have any crash logs (eg: launchd_sim crashes) in ~/Library/Logs/DiagnosticReports? If so, check if they show DYLD_INSERT_LIBRARIES being set. If that's the case, your options are to either update to an OS X Yosemite host (which will deal with this issue) or unset DYLD_INSERT_LIBRARIES (likely set in /etc/launchd.conf or ~/.launchd.conf)
Force Quit All the apps including xcode and simulator
Restart MAC
Checking in the "Locations" Xcode preference, I had two items of the same version, one located in the app translocation area (/var/.../AppTranslocation/...). Also I had previously done a manual command line tools install. To resolve this in the end I had to delete /Applications/Xcode.app and remove the manual command line tools install:
sudo rm -rf /Library/Developer/CommandLineTools
Then installed Xcode anew, and rebooted. Boom! Simulator working again.
Reboot your mac os. its working correctly on xcode 11.3.x and mac os 10.14.6.

Resources