I was trying to run my project on Xcode, but I found that when I hit Command-R, Xcode would say the app had built, and was running, but after 3 minutes, it still hadn't appeared on the simulator. I ran it again, and it did the same thing, so I force-quit Xcode, and reloaded it. When I had reloaded Xcode, all the simulators had disappeared, and when I try to run the app on my phone, Xcode starts building, and then just stalls when processing one of the XIB files.
I have tried going to Windows->Devices to reinstall a simulator, but Xcode just freezes when I do this.
It seems I have royally screwed my developer environment by force-quitting while it was building. How can I fix this?
All help app-reciated.
Try to exit the simulator.
If this doesn't work try to restart the computer.
if none of them work you are screwed and should reinstall xcode
I fixes this by downloading the Xcode 7.2 beta. If you're viewing this question at a later date, download the newest beta of Xcode (or if you're using the beta, download the standard code). This version of Xcode is completely separate to the standard Xcode, allowing everything to run on normal settings.
First try and restart Xcode, then your computer. If this does not work, reinstall the newest version of Xcode from https://developer.apple.com/xcode/
Related
While I am try to run an app in the iOS 10 simulator using xcode8 I get these alerts frequently. They randomly appear two at a time and it is not apparent what is triggering them.
Below is Image for Error I got.
I tried Following things.
Clean & Rebuild an app
Restart xcode & Simulator
Clear Derived Data & Rebuild application.
Even I was getting the same error. Issue in my case was I was working on xcode 7.3 and its simulator was open, later on I closed xcode 7 and opened xcode 8 and tried running app and got the above error.
I guess its happening because of both the simulator were open, it got solved when I closed my older simulator. Seem to be some problem while xcode 8 was trying to establish connection with simulator.
You just follow these steps to remove this error it's working fine in my side and i hope these steps work to you also just try it.
i)Remove multiple xcode versions.
ii)Quit all Xcode and simulators.
iii)Only one version you opened.
iv)Go to Xcode -> Preferences
v)Go to Location
vi) Set proper version for command line tools (your Xcode version)
vii)click on Derived Data
viii)Then go to Derived data and delete that folder. see below image
ix) Click on Simulator reset content settings and just quit xcode and simulator and open clear and build the xcode and run it.
Without deleting "Derived data" folder
The same rules as in the past apply to switching between Xcode 8 and
Xcode 9:
Quit Xcode, Instruments, Simulator.app, and Console
xcode-select the version you want to work with
Start the version of Xcode you want to use
If these steps don't resolve the problem for you, you can repeat the steps above > but after #2 add "sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService".
from this https://forums.developer.apple.com/thread/79301
The Same issue I have faced when I have two Xcode version, but the issue was when we are opening the two instances of simulator we will get the same error, the best way to solve this issue is run command
rm -rf ~/Library/Developer/Xcode/DerivedData
to remove the derived data.
None of the above worked for me.
Instead of choosing the simulator and hitting "run" i solved it by opening the simulator form "Open Developer Tool" menu first. After that all worked fine.
I had a similar issue, despite not launching a second instance of the simulator, due to using SimPholders and having the XCode Command Line Tools set to a different version of XCode. To resolve this, open up XCode preferences, and under the Locations tab ensure that the Command Line Tools version matches what version of XCode you're currently working in.
I had the similar issue shown in below screenshot.
Got it solved by closing Xcode 7 and its simulator.
It seems that when you are working on Xcode 8 and its simulator then Xcode 7 simulator should not remain open.
Below is screenshot of simulator state for Xcode 7 when you're working on Xcode 8.
In my case,
I was open a project a Xcode 8, and the emulator for this version, then open this project on Xcode 7.3.1, when I create an emulator it shows the alert.
My Solution: Close all version of Xcode => Clear Derived Data => Quit Xcode => Open Xcode => Choose File => Open Recent.
Force Quit.. Xcode and simulator. This kind of issue happned because maybe you are try to run more than one different version Xcode at same time.
I just had this issue when attempting to debug an iOS application from Xamarin, which uses Xcode to run apps in the simulator. I was initially targeting a 9.7" iPad Pro, attempted to change the simulated device to an iPad Air 2 (still on iOS 10), but the simulator didn't respond. After quitting and relaunching the simulator it appeared to load okay, so I changed back to the previous device - not sure whether changing devices actually did anything but I haven't seen the error message in the few times I've run my app since.
Solved it by closing all xcode and simulator. Don't ask me why. It was happening on the beta version for me
I had similar issue, what I did is I closed the simulator and all the Xcode and I went to the terminal and typed to see any Xcode application running then I killed it. I had one Xcode running in the background.
Command to see if Xcode is running,
ps -e | grep -i xcode
Use kill comment to kill any runing Xcode app, I used
kill -9 <pid>
The Same issue I have faced
in my case i stopped all applications and restarted my mac
and every thing is OK
Simple And fast Remedies..
1.Quit all xCode and reopen the xCode which you need to work...
I had this problem too, but I did below process it's working fine.
You have both Xcode 8.x.x and 9 running on your Mac, which causes the problem. Only run one Xcode at a time (Quit another Xcode, don't let another Xcode runing in background!).
This can occur when you have more than one version of Xcode installed on your computer. Make sure you QUIT (not just close) all versions of Xcode first.
Changing the device seems to have worked for me after doing the other stuff. Didn't have to restart my computer.
Problem: I cannot simulate an Apple watch interface. Whenever I try and test my Apple watch app on the iPhone 6 simulator, Xcode successfully finishes and builds the app, attempts at opening simulator and fails with an error message which reads 'Invalid Device State'.
I believe simulator has a watch simulator that opens along with the compatible iPhone simulator models that can communicate with Apple watch (example: iPhone 6) Although I have yet to see it work. I have built a universal interface for iPad and iPhone and another for the watch, so it's not a matter of the app being for the wrong device. Whenever I test on my actual iPhone I can test the universal interface successfully.
I'm using Xcode 6.2 on iMac OS X 10.10.3
I have tried restarting Xcode/Computer. I can't seem to find any other mention of 'Invalid Device State' anywhere, hopefully due to it being an obvious thing to avoid/fix that I've overlooked. Any help would be appreciated.
Force Quit xCode and restart will resolve problem.
I had come across this issue after updating Xcode 6.4 to 7.1.
Below are fixes for this :
Clean project (cmd+shift+k) as well as clean build folder
(cmd+shift+k+option)
Quit simulator and run again
Quit Xcode and Simulator and run again
Restart your Mac.
Solution 3 worked for me!
I had the same issue. Generally it is because you just update Xcode or change its name in the Applications folder.
If you just restart your computer it will work correctly.
Hope it helps !
I observed this happening when more than one Xcode app installed.
To fix this,
Launch Xcode and click preference..,
Go to "Location" Tab, Select correct options from "Command Line Tools" dropdown
Quit Xcode and relaunch it.
Run your app.
First of all, just clean the project.
Quit your project.
Quit your Xcode.
Restart Xcode.
This happens to me when I have two different Xcode versions running at the same time. Hopefully this helps you.
No need to quit, restart or even re-install. Switch to another iOS Simulator device (6s if you were using 6s plus) and voila!
Nothing worked for me on XCode 7.3.1.
Had to reinstall it to make the simulator work.
Go to applications folder. Drag drop XCode to Dustbin.
Empty dustbin contents.
Go to App Store and install XCode.
Run XCode. The simulator should work now.
I have Xcode 7.3 and Xcode 8.0 Installed.
If a am working with Xcode7.3 and opens Xcode8.0 to get some code from Xcode8.0 project.
When i run my application on Xcode7.3 So it will give me same error.
Solution is simple ForceQuit or Quit all Xcode's and open the required one.
In my case, the simulator would show an indefinite black screen whether attempting to run a project, or running the simulator directly (which should bring you to the simulated home screen). This would happen even on a newly created simulated device.
After the existing suggestions failed, the following worked for me:
Delete the Simulator
Delete XCode
Delete the Developer folder
Reinstall XCode from the app store. This requires attempting to run XCode again so that Mac OS will realize it's no longer installed.
Jus clean the project and restart Xcode. This happens to me when I have two diffent xcode versions running at the same time.
Robust fix is Just Quit your xcode and run again, hope so it will help you. This heck work for me.
On M1 Mac I've found more than 3 open simulators can cause this error. Quit the simulator app to fix this error.
I am pretty sure that in my case the simulator was corrupt after a failed language change.
Following this answer to reset the simulator worked.
I cannot get the iPhone Simulator to run the current code. Instead it runs an old build. Does anyone know why?
The simulation starts and stops as usual, but somehow Xcode and Simulator have lost their connection. The Simulator ignores any changes in the code and Xcode ignores any breakpoints.
I have:
Deleted the app in the Simulator.
Reset content and settings in the Simulator.
Cleaned the project in Xcode.
Removed the project from Organizer.
Restarted Xcode and computer.
System info:
Xcode 6.0.1
iOS Simulator 8.0
OS X 10.10
If someone can tell me why this is happening I would be very thankful!
By the way, I can run the code on a device without problems.
Try to reset content and settings of the simulator. Like on the image:
Clean and rebuild the project also may help.
When I upgraded to Xcode 6.1 AND downloaded a new iOS 7.1 Simulator (available at Xcode/Preferences/Downloads) then it just started to work again. So, to upgrade or simply reinstall Xcode seems to solve this problem.
EDIT:
I recently got the same problem again, and I fixed it this time by going to Project Navigator/Targets/Build Settings/Build Locations. Changed the text of Build Products Path to something random, and changed it back again.
Sometimes, if you move your project folder around, it seems that Xcode loses track of its build folder. By doing this Xcode restore its build-path. So try this method first.
I'm trying to test out my app on my ipad and when I decide to run it on my ipad, Xcode says that it's successfully built. On the top, it says that it's runnning the app, but nothing happens for 2-3 minutes. Finally, I get two screens popping up saying "An unknown error occurred." I have tried running other apps through Xcode on my ipad and they work fine. I also decided to exit Xcode and restart everything, but the problem still exists. Does anyone know what the problem is?
Not sure if this will be useful but
Xcode Version: 5.1.1
Ipad Version: 7.0.4
Mac OS X 10.9
I found one approach:
Before this approach make sure that you have all certificates and other documentation updated.
I have faced same issue, now I have a way to fix this. I am using iPhone 5 with OS version 9.1
First, delete the app from your device and then restart the xcode by force quit and then again open it. Now clean your project and run the project in your device. Now it will be run without any issue.
Close your simulator or unplug and plug back in your device, and re-select the device target.
In my case . I cleaned the product and rebuild it and it worked.
Sometime is you forget to unlock your device.
I'm getting a weird bug on Xcode 4.5. When i tried to run my application on Ipad 2 from xcode with iOS 6, I'm getting this error.
I done the following methods to run the application, but no luck.
Cleaned the project and run
Restarted the device
Restarted xcode
I have a valid certificate in my machine and the application is installing on the device but it's not launching automatically. What could be the issue ?
Thanks in advance
That is really annoying. This error happens in a number of different situations. Sometimes restarting the Xcode, fixes the problem. If not, follow these steps:
Disconnect your device.
Delete the app from your device.
Quit Xcode (Do not just simply close the window, quit it)
Delete derived data folder (~/Library/Developer/Xcode/DerivedData/-gbrvhlvwmpiobxdujegtghggrffp - or something like that)
Now start Xcode once again, connect device and run the project. It should work fine.
from DhilipSiva blog