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.
Related
The following error occurred when I tried to run a project on my iOS device. Running it on a simulator works fine.
The other weird thing is that I am able to run my other projects on my device, only this particular project that is giving me this error.
I tried all the solutions I'm able to find:
Cleaning the project, deleting derived data
Restarting Xcode, my Mac, and my iOS device
Deselect 'Automatically manage signing' in the testing Target.
I couldn't delete the app from my device and re-install it because it wasn't installed on my device before.
Any help would mean alot to me! I am using Xcode 8.1 with Swift 3.0, running on a iOS 10.1.1 device.
Close your Xcode completely from currently running on Dock
Unplug your iDevices cable at your Mac and plug again.
Open Xcode Again.
Clean,Build and Wait for indexing the device
Delete the previous app you install on your iDevice
Then install
If you have free Developer ID, make sure you got the Internet access
right on your iDevices.
Else,
Check your provision profile or certificates of your app that it's still available or not [Expire or not].
If expired, please create again.
Install those latest provision profile at your Xcode Preferences/Account/Detail/
Make sure Signing "Debug" and "Release" aren't empty
Close the Xcode(Completely quit from Dock) after you completed those steps
Open the Xcode again and do Clean,Build and Install
Hope this help.
Other alternative way,
Remove the app on the device and re-install
Change build version no and install again
Clean your the project and reattach your device
Do a pod update if you are using CocoaPods. This error can occur due to one of the pod libraries, device logs can be checked for the name of the library.
I get this error only on the second compile for device targets, and I've found that if I just modify one critical source code file by adding just an empty line, the error goes away and Xcode will compile again. The other way is to target a second device which isn't always convenient.
A way around this confusion is to add a an Xcode Run Script that basically does this for you.
Force Xcode 9 to recompile after a build seems to be file dependent also
touch ${SRCROOT}/MyProject/MySourceFile.swift exit $?
With the above script my issues went away, and I never saw the Xcode Alert again. This bug has been in several iterations of Xcode now.
I have the same problem too, and also tried all the solution like you. unfortunately, not solve this problem, but I copied my project to another path, the copied one can build on my phone successfully, hope this can help you.
It can happen if you have debugged the same app(bundle identifier) with more than one Apple Ids. Remove all accounts from Xcode and sign in to the one which you're currently working with.
Restart your Xcode & Uninstall your app.
Build & Clean your Project, now it working good.
this works for me
above is not working please Restart your system
This error message occurred when I was building on an iPhone 5 and an iPhone 6 Plus with Xcode 10. Build in iPhone 5s Simulator gave a different error: "App could not be installed at this timeā¦/Notification Extension: No such file or directory"
Problem was resolved by check marking Target Membership in my Notification Extension's source file.
I upgraded to OS X 10.11.5 and Xcode 7.3.1 a few days ago and all seemed well. Then today after adding my new iPhone 6s Plus to the device IDs in my developer account and having Xcode do an automatic 'fix issue' to update the provisioning profile when trying to run my apps on my new device, I am now getting Invalid Device State errors on all my simulators in all my apps. Running the apps on my new device works fine, but all the simulators give me the error. I tried the solutions found here iOS Simulator: Invalid device state and here Invalid Device State - Xcode/iOS Simulator error but neither have resolved my issue. When I run xcrun simctl list all the devices show a status of Shutdown, which I assume is what the status should be. I then run xcrun simctl erase all and I get no errors. I then did a clean build and a clean build folder, and restarted my Mac, and still the error occurs after doing all these steps. This is really frustrating, and I hope someone can point me in the right direction. I always get nervous when it comes to upgrading OS X and/or Xcode because more often than not something breaks in my apps, or something like this occurs.
I tried everything possible to get this to work for two days. Finally I re-installed Xcode and that did it. In case someone runs into this issue and the regular solutions do not work, don't waste your time trying to figure it out, just re-install Xcode and save yourself some time.
just quit xcode and simulator. it will resolve the problem.
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/
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'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