iOS Build Failed at compile time with issue "failed to find a suitable device for the type SimDeviceType" - ios

I am getting following compile time issue when running the app with Xcode 10.3 beta 2 on iPad Air, I am getting the below issue.
Failed to find a suitable device for the type SimDeviceType : com.apple.dt.Xcode.IBSimDeviceType.iPad-2x with runtime SimRuntime : 10.3 (14E5239d) - com.apple.CoreSimulator.SimRuntime.iOS-10-3
Any help is greatly appreciated.

It seems like the old simulator process remained open in the background during an XCode update.
Simply running
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
in terminal may solve the problem.
There shouldn't be a need for cleaning the project and/or build folder.

If you quit Xcode and still get the same error, then try clean (command + shift + option + k) and select option "Clean" in popup. Repeat this 2 to 3 times. It works in my case.

I was experiencing the same problem. In my case, I had launched the Simulator from a previous version of Xcode prior to building. The problem persisted when I quit the simulator, but restarting Xcode solved it for me.

I just ran into the same issue on the latest Xcode 10.3 (10G8). Had to perform about 4 or 5 full project cleans, and bounce the box, before I could compile again. I wish Apple would get this fixed.

I simply had to disconnect the iPad I had connected to my Mac. For some reason that was messing with the way Xcode was compiling.

The only thing that solved it for me was the following:
Clear the ~/Library/Developer/CoreSimulator/Profiles/Runtimes folder
Restart Xcode
Clear the project
Run the project

I solve this by launching the simulator first, Xcode will pass the build.
then run the project on the device.
hope this will help

If you are running multiple versions of xcode, you should check xcode-select -p to ensure you are using the correct version of xcode and compiler. If not, use xcode-select -s { correct xcode path } to set the correct version of xcode.

Getting same issue but after an hour getting success to fix this issue there is xcode problem. So please reopen your xcode and then clean your project.. or use short cut command for clear (command + shift + option + k)

Related

Build failed with xcode 10 beta

I created a new project on Xcode beta and built it, It gives me the below build error.
Encountered an error communication with IBAgent-iOS on launchscreen.storyboard.
The same storyboard error that I am getting when I try to build any sample projects built on Xcode 10 beta.
Has anyone come across the same issue with Xcode 10 beta IDE?
I face the same issue with Xcode 10.1... issue resolved by just clean the build folder using Command+Shift+K
I hope this will work for you.
I'm on Xcode 13 and still get the issue sometimes. No help with cleaning the build folder or removing DerivedData.
However, this usually saves my life ^^
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
I had the same problem with xcode 10 installed from the App Store and I tried removing the derived data, cleaning the build folder... nothing worked.
And then I just restarted my computer and it's working. I did not rename anything. It must be some glitch in the memory which is solved after restarting the system.
I had the same error.
I renamed Xcode from Xcode-beta to Xcode and it worked for me.
You need to remove the Targets from that xib, compile and add them back to your xib and compile. It works!
I renamed the
Xcode to Xcode10 (from finder > Applications),
and then cleaned the build folder
(Xcode > Product > Clean Build Folder).
It worked for me.
Remove the product file (.app) if old build exits
Clean the build (Command + Shift + K)
I'm using Xcode 11 but still, encounter this problem, I've tried to clean the project and rebuild it but it still won't work. The only solution I found it work is to uninstall Xcode and download the new one from App Store, this work fine with me and I can use it normally now. I hope this works for you guys too. Cheer.
If you are getting this issue, then I think it is bug of an Xcode 10. The only fix is uninstall your Xcode 10 , and reinstall it again . It will definitely work. This worked for me. Thanks.

Software caused connection abort. Error returned in reply:Connection invalid

My Xcode 9 gives the message to which I don't know how to respond. I want to run the app to my simulator, and I am getting this weird message. Attaching the snapshot for the same.
If you are using two versions of Xcode, remove one or quit all Xcode and simulators.
Go to preferences and Set proper version for command line tools
click on Derived Data, go to Derived data and delete that folder or simply use rm -rf ~/Library/Developer/Xcode/DerivedData
Click on Simulator reset content settings and just quit XCode and simulator and open clear and build the Xcode and run it.
Swapping between 2 versions of Xcode (8.3.3 and 9 GM) gave me this problem in Xcode 9. Solved by Xcode->Preferences->Locations->Command Line Tools, set to Xcode 9. Needed to quit Xcode and the simulator, but it then worked.
I had the same issue:
Try to:
- kill simulator (force quit)
if it won't work, restart mac - it is funny but for me it worked
Restart Xcode & Simulator. delete the app from simulator make clean & try to deploy again. it works for me.
It seems that there is error while Xcode is trying to connect with Simulator/Device in order to run app.
So there are multiple solution to this issue :
Clean project (shortcut : cmd + shift + k) / Clean Build project (shortcut : cmd + shift + alt + k)
Delete derived data content (Open Xcode preference using cmd + comma). Goto Location tab. In Derived Data section press on arrow symbol.
Quit Xcode and Simulator
For me solution 3 worked!
Same error. For me running xcode-select helped:
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/
This is because you have multiple versions of Xcode in your system. Just quit all the other versions of xcode and also the simulators. Restart the required version of Xcode and it should work.
You need to select the latest version of the command line tools in the preference pane.
Xcode -> Preferences
In the Locations tab change the Command Line Tool pop up to the latest version.
Restart Xcode and the Simulator
I faced the same issue. Quit Xcode and Restart Mac. This worked for me.

Xcode 9: Could not attach to pid

I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.
It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).
Could not attach to pid : “2370”
Ensure <project title> is not already running, and <system username> has permission to debug it.
Here is a snapshot for the same issue:
What would be permanent solution of this issue, as it's disturbing frequently?
If issue is on OS Mojave and you are trying, like me to run tests on older Xcode version (lower than 10.0), make sure that in your scheme, when you select Test, Debug executable is disabled
You won't be able to debug tests from this point
Still not a permanent solution, but I had to quit and restart Xcode as the other solutions did not work for me.
This worked for me:
Edit Scheme -> Info -> Executable -> Ask on launch
Credits to #nastya-gorban's answer here
Update
After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".
Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.
If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:
We suggest that you use automatic signing for your debug builds and
manual signing for your distribution builds.
Killing my simulator and then running it again from Xcode.
I had this issue too. There seems to be an issue with having two Xcode version installed at the same time. (9.4.1 and 10.0 Beta)
It works with the beta, but not with the stable version. Everything is set to the tools of the Xcode 9.4.1 stable version. I can only run my unit tests with the beta.
After removing the beta, it worked with the stable version.
delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that
I have been dealing with this issue for days. I have been able to build but not launch on Simulator, and I get the same "pid:.." error message.
I am using:
- Xcode v9.2
- Swift 3.2
- Building for iOS
The things that I tried that DID NOT WORK were:
restarting the computer; deleting content and settings (of Simulator, I do not have "reset"); uninstalling and reinstalling Xcode; changing "Deployment Target"; changing the device in the simulator's Hardware->Manage Device; deleting Derived Data, Cleaning and Building, or just waiting...forever.
What WORKED was as #Rajasekhar mentioned:
checked out the Keychain certificates.
deleted the exiting ones by right clicking (they'd passed expiration)
and unchecked "automatically manage signing" in Targets->General
After that it successfully launched in Simulator. I don't know if the issue will come back but hopefully this works.
Even on Xcode 11.1/2/3
It is an Authorization issue with Simulator,
When Simulator does not have the necessary access. It raises the issue.
Try following in Terminal
sudo DevToolsSecurity -enable
or
sudo /usr/sbin/DevToolsSecurity -enable
Details can be found here
I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.
Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.
What worked was to run Xcode (9.4) with sudo,
sudo /Applications/Xcode.app/Contents/MacOS/Xcode
I don't see why sudo is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into /Applications. It is not codesigned. Posix permissions on the .app, its Contents, its MacOS, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.
The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with sudo. Without sudo,
error: attach failed: unable to attach
I had same issue. Check screenshot.
Below are few solutions that should work:
Rerun project
Clean (Shortcut: cmd + shift + K) and Rerun project
Quit Xcode and Simulator. Open project and run again
Reset content of Simulator (Select Simulator -> Goto Hardware tab -> Erase All Content and Settings…) and rerun project.
Solution 4 worked for me.
This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.
(most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings
(less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)
I was seeing this in Xcode 10.2 and the cause for me was that lldb-rpc-server was crashing. I worked around it by ensuring either Address Sanitizer or Thread Sanitizer is enabled in the debug options. I also filed a bug report viewable on Open Radar.
I tried all the answers above. The only thing worked to me is changing the build number.
In my case (Xcode 10.1), this was the error in the console:
kernel macOSTaskPolicy: (com.apple.debugserver) may not get the taskport of (bin) (pid: 10132): (bin) is hardened, (bin) doesn't have get-task-allow, (com.apple.debugserver) is a declared debugger
So the solution was to disable the Hardened Runtime, clean the build folder and run again.
This is the issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.
This happens on my machine, when I set the 'new build system'
Go to menu file=>workspace settings and set Build System to "Standard".
I realise this is not a problem with a single solution, from all the other answers. So, here's what worked for me:
1) Reboot the machine
2) The first run always works for me. The only thing that helps me avoid this error after this first run, is to stop the application from XCode, instead of just clicking the Run button to re-run the application.
Another thing, when I lock my computer the issue re-appears sometimes (probably when I forget to stop the application). So I have to reboot my machine again.
After doing some digging, this worked for me on Xcode 10.3.
sudo /usr/sbin/DevToolsSecurity -enable
In my case the only thing that worked was switching back from the "New Build System" to the "Legacy Build System" in the Workspace Settings. Bummer.
It's an issue with authorization. Try this in the Terminal:
sudo DevToolsSecurity -enable
First, close app completely via sim (not sleep - close app totally)
If not working yet: reboot whole PC, ensure only 1 simulator is active upon reboot.
More than 1 sim can confuse it if it's bugging.

Unable to open liblaunch_sim.dylib

Today I have updated xcode. when i tried to run project on simulator(ios version < 9.0) I got this error.
"Unable to open liblaunch_sim.dylib. Try reinstalling Xcode or the simulator runtime.
It ran perfectly on ios9.0 simulator.
here is screen shot. please help me.
This will also occur when you don't have the simulator actually installed within XCode. I recently upgraded to XCode 7.1 and didn't install all simulators and received this same error.
Go to Preferences -> Downloads
Verify you have a checkmark next to the desired Simulator you are trying to run within XCode.
If no checkmark, then install the simulator of choice. 8.1, 8.2, 8.3, 8.4
I don't think that there is an "officially supported" way to solve this yet, but have a look at this answer (which originates from this more detailed troubleshoot) for a potential fix.
[Edit] In you case, try running those:
sudo cp "/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.‌​dylib"{,.bak}
sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/D‌​eveloper/SDKs/iPhoneSimulator.sdk/usr/lib/system/host/liblaunch_sim.dylib" "/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.‌​dylib"
First, find the target file:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system/host/liblaunch_sim.dylib
You need make backup liblaunch_sim.dylib
Second, copied to destination (Remember to backup)
/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib
And If need it to: iOS 8.1.simruntime iOS 8.2.simruntime iOS 8.3.simruntime All done.
Hope it helps.
I faced similar problem this problem occurs when we have multiple versions of Xcode Installed ... So i force quit all the xcode and simulator and then open the xcode version you want to open.

Failed to launch IBCocoaTouchImageCatalogTool via CoreSimulator spawn

I have an Xcode project which was downloaded from the internet so I don't know which Xcode version was used to write it but the language is Swift 2. I opened it in Xcode 7.1 beta 1 and I get the following compile time error.
Failed to launch IBCocoaTouchImageCatalogTool via CoreSimulator spawn
I deleted the DerviedData foler, cleaned and build the project several times. Tried converting the project to latest Swift syntax but it says there's nothing to convert.
I'm all outta ideas. Suggestions?
The same happened to me and it was solved by cleaning the project. However, if you cleaned it —as you say you did—, I would try closing and reopening Xcode. Even though it seems stupid, it works more often than not.
So After Trying a bit i removed the XCassets file form the Copy Bundle Resources, build once without it and then added it again. Solved it for me.
I had the same issue. My solution was to do the following
Clean the Project
Quit Xcode
Reopen Xcode
Build
That got it working for some reason...
The above answers are correct.
I have a bit similar approach.
After, I use these steps:
Clean the project.
Remove your Assets from your project(Remove References). Run the project without assets. Now the project will show some compile errors, these are not very tricky.
Run the project, this time project run without your assets and may be chances of crash. This ensures that project will run.
Now clean the project and add the assets, now run the project. The project runs successfully.
For me it works. I hope it will be helpful to you.
The only correct solution for me that takes only a moment to perform is to delete ~/Library/Developer/CoreSimulator and all of its contents. Immediately after this the build completes successfully.
I believe the solutions that state to reinstall Xcode, ultimately refresh the CoreSimulator folder, that's why they are successful in resolving the issue.
I started experiencing the error after having upgraded to MacOS Big Sur, while using Xcode 11.6 and Xcode 11.7.
Possible solution for those struggling with the above answers.
If you've just restored your machine from a time machine backup (migrating from old to new machine), you may want to re-install Xcode.
It doesn't appear to bring the caches or other important settings across properly from the time machine restore.
I've just taken that; what appears to be a drastic step, but it's worked!
Instructions on how to do so: Completely reinstall Xcode 9
-W
I was also facing the same issue tried cleaning and restarting XCODE didn't worked for me,
so I removed xcassets and added the image sets again one by one, and that worked for me.
Had to add a step Airman00's answer.
List item
Clean the Project
Quit Xcode
Delete derived data
Reopen Xcode Build
That got it working for some reason...
Update to XCode 7.1.1 from 7.1 solved my problem.
With XCode 7.1 I used Airman00's solution but suddenly it stop working.
Hope it helps!
If you have this type of error in your project then follow these steps:
Clean the project
And go to storyboard and select any viewController
And Run the project again
This will successfully resolve the error.
Maybe you have just cleaned Logs directory...Then you can try this:
sudo chmod 777 /Users/[YourUserName]/Library/Logs
I had to restart my machine to get this to work. Just in case, here are the exact steps I did:
Clean project
Quick Xcode
Delete Derived Data
Restart machine
Reopen
I had the same problem recently with Xcode 11.4 on Catalina 10.15.4.
Rebooting, cleaning project folders, or deleting the derived data directory did not help. What solved the problem for me was to remove and reinstall Xcode (I use the AppStore version).
It is possible, that I caused the problem myself by reinstalling macOS 10.15.4 via a Combo-Update.
I tried everything . But nothing worked . So i reinstalled Xcode . I took some time . But worked
Xcode 14 beta solution
If you are finding your production Xcode 13 builds aren't working and you have Xcode beta 14 installed you can try this:
Launch Xcode 14 beta 3
Open the Platforms preference pane
Xcode 13 should now work as expected
Source: https://twitter.com/AnaCalinov/status/1545118596820439040

Resources