Related
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 running an app on my iOS device but, in Instruments, that device is greyed out.
This also means I can't attach the process (Cant launch iOS app with Instruments on device). Is it anything to do with my earlier question: Instruments > Profile - Revoke and request
Xcode: 6.1.1
iOS: 7.1.2
Any idea why?
I only had to reboot my phone (not my Mac), and then the error went away
(Xcode 9.2, iPhone X running 11.2.6).
i was having this issue and resolved it by
Unplugging my device
Turning my device off
Rebooted my mac
Turned device back on and plugged into computer after logging back in.
now it shows up in instruments. I tried unplugging device, restarting xcode, but that didn't work. rebooting everything is what did the trick for me.
I met the this problem. Xcode(Version 9.3.1 (9E501)), iphone 7, And I forcely quit the Instrument. It's work
I came across same problem today on xcode7.2.1, iOS 9.2.1, iPhone 6Sp. Resolved by rebooted my mac, my watch and the iPhone.
If your workspace contains several projects and/or several targets, it seems that XCode doesn't know which binary to profile.
Just Edit your scheme -> Profile -> Choose an Executable and it should enable the profiling option.
I had the same problem where Profile was greyed out. It turned out to be I had the device option at the top set to Generic iOS Device
// this will make Profile greyed out
Once I switched it to an actual simulator device or my actual device Profile was no longer greyed out
One other option can be to in Xcode at the top go to Help > search Edit Scheme and select it > on the left side of the screen select Profile > change Executable drop down to your_project's_name.app
I don't know which process helped but I force quit AppleMobileDeviceHelper and DTServiceHub in the Activity Monitor and then it started working again (I was able to select my phone without rebooting).
Recently, I confronted the question again on Xcode Version 10.1 (10B61), iphone 7 and Mac 10.14.1 (18B75). I resolved it by upgrading the deployment from 8.0 to 10.1. In fact, I have meet many strange Xcode bugs caused by the version, liking this one(xcode gpu shader profiler)
It turned out that my iPhone is not trusted my computer.
How to re-trust computers, see:
https://www.wikihow.com/Trust-a-Computer-on-an-iPhone
In short, you should reset Location and Privacy in settings, and then plug-in your iPhone again. And you will see 'Trust this computer' again.
My issue what that it was asking me to trust the computer every time I plugged it in.
To fix it, I had to turn on the Hotspot then turn it back off.
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've been running my app on an iPhone 5 /iOS 6, but when I try to run it on an iPhone 4S / iOS6 I get "The run destination iOS Device is not valid for running the scheme NN. The Scheme contains no buildables that can be built for the architectures supported by the run designation device".
I've looked at previous postings on this but they involve issues with the Deployment Target.
In my case I've got the Base SDK set to 6.1 and the Deployment Target set to 5.0.
The iPhone 4 has got iOS version 6.0.1.
It was a bug in XCode, I closed and reopened Xcode and it started working.
I've noticed this sort of thing many many times now with Xcode with other problems, its very frustrating that the tool is so dodgy.
I had the same problem. The issue that i found is that , by mistake I had chosen iPad as deployment target due to which XCode showed that iPhone 5 is an invalid device. .
Hope it helps. Then I just changed the target to iPhone and it worked.
The run destination iPhone is not valid for Running the scheme.
Quit Xcode
Open Xcode
Clean project
Run project
It will work
This is some sort of memory issue sometimes.Close some application and try again.
Close Xcode too and reopen. Worked for me.
Cheers.
Quit and Reset Xcode can reslove most problem. The other cause is Device not support iPhone, you can
Target -> select scheme -> General -> Deployment Info -> Device-> select Universal or the current device you want.
In my case the problem was missing executable value selected into Scheme -> Profile -> Executable (e selected from the dropdown build configuration debug and executable the "application".app).
A simple solution.
1) Force quit X-Code
2) Force quit itunes
3) Reconnect iPhone
4) Open X-Code
Go to project info set development Target as 4.3 or 5.1.1 and same in target also.
I had this problem in XCode 9.0.1.
It seems that XCode does not refresh the list of connected devices.
You may notice that after disconnecting your device, you can still choose it as a target. So XCode may actually be trying to connect to a bogus device.
To fix this:
Edit the scheme.
Re-select the scheme's executable.
this seems to force XCode to update the list of connected devices.
If that did not work, try reconnecting your device (cable) before you do this.
Or perhaps, some other combination of disconnecting device, connecting device, and re-selecting the scheme's executable.
As a desperate measure, you may also try to change the cable that connects your mobile device to your pc.
But ideally... Xcode should be fixed.
Just Go to Devices -> The Intended device you wanted to run (I Was iPhone6 Simulator)-> Select the Device (I was selected iPhone6) -> Right Click-> Make sure the ‘Show the Run Destination Menu’ enabled.
For Me, it was enabled. I did, it worked.
I faced this issue in XCode 9, but later realised that for some reasons I had unchecked run destination in "Devices & Simulators" window
In my case, none of the answers given worked for me.
I was trying to setup TravisCI to my project and this is what i did:
Select Target > Edit Scheme > Build
Check the "run" option in the Tests target and the issue disappeared, i hope this help someone, i spent 2 days trying to fix this.
Other solutions might work for other scenarios but, in case using Xcode 11, I went into "Build Settings" of my test target and changed to universal under "Deployment"->"Targeted Device Family"
Select your project, Under Targets, select your main target, then on the Build Settings Tab, there is one field that says "Valid Architectures". Make sure "armv7" is also there. You probably only have armv7s right now.
I am using XCode 8.2.1 having same problem.
Solution:
->Go to Devices
-> Add additional simulators
->Right Click simulator u are using
->Show in Run Destination Menu <-Enable this Option
For me Xcode failed to copy symbols for connected device due to low disk space. First check if you have symbols connected device under /Users/$USERNAME/Library/Developer/Xcode/iOS\ DeviceSupport/.
Since I had iOS 8.3 (12F70) installed on my device the path for me was /Users/$USERNAME/Library/Developer/Xcode/iOS DeviceSupport/8.3 (12F70)/Symbols The size of this directory should be around 2.5GB.
When I got this issue the size was 484 KB.
To fix it I
Free up about 3GB of disk space. You can delete folders for any unsupported devices that you might have under /Users/$USERNAME/Library/Developer/Xcode/iOS\ DeviceSupport/
Disconnected device from Xcode and closed Xcode.
Removed the folder in above path (everything under 8.3(12F70).
Start Xcode and connected the device.
Xcode should start Copying symbols once done the size of the folder should be around 2.5GB
This happened to me because I switched branches in source control with unshared schemes.
My xcuserdata folder was git-ignored, and it contained a scheme I forgot to share. This meant I was trying to use a scheme that was from a completely different code branch.
I remade the scheme which fixed the problem, and marked it as shared so that it would be in the xcshareddata folder and checked into source control.
For my case, check the target -> Build Settings -> Search "Mach-O Type" and check the value, it should be Executable/Dynamic Library/Static Library. For other type values, the target could NOT be built and run.
This is similar to Kunal Gupta's comment, but I got this error after running an Xcode project on an actual iPad (the deployment target was changed to iPad and I wanted to run it on my iPhone simulator). Remember to change the deployment info after you use an actual device/simulator, especially when switching from iPad to iPhone.
Swift 3 or 4 Xcode 8 or 9
One thing you can do is click the Project file to open up General Settings, Capabilities etc.
Choose Build Settings
Search for Base SDK
Make sure debug AND release have the same build type.
I had debug set to ios 11.0 and release set to macOS 10.13
They must be the same in order to Archive
In my Case,
I open my iPhone here is the alert appearing in my iPhone for Trust and Don't Trust. I click on Trust. It works fine.
Switching to a different USB port and restarting Xcode solved the problem. Experienced this issue on iMac running Xcode 9.1 whenever I tried connecting any iOS device to one specific USB port. If your USB ports stopped working, check this.
Open the Apple Menu > About this Mac > More Info > System Report > USB and check that the device appears in the USB Device Tree. If it is not here try another USB cable.
I notice this with certain cable+device combinations (probably bad contact), restarting the XCode will only help for one or two runs and then it strikes again. Changing cable / device is the only long term solution worked for me.
In my case, this issue was fixed changing the Architectures (Build Settings --> Architectures) to Standard architectures - $(ARCHS_STANDARD)
Make sure to have arm64 armv7 armv7s on Valid Architectures.
In the case of iOS 13.x - What worked for me is unpairing my watch to my phone and repairing it to my iPhone. I wouldn't just unpair it via Bluetooth- I repeated the whole cycle as if I got a new watch. It took 10 mins to do the whole thing. When I ran my app again, it worked. From there, ensure all your Targets have the same sign in for identity.
Device Support Files is missing for device iOS version. Add it in XCode App Content path.
App Content Path is "contents/Developer/platform/iPhoneOS.platform/DeviceSupport"
Dowloaded support files from here and past them by creating folder of device version number there in app content path.
Go To General => Supported Destinations add IPhone or whatever platform you want run your app.
I encountered this issue while trying to run a watchOS app. After restarting both the Apple Watch and the iPhone, it displayed a different error message that informed me about the Developer Mode setting being turned off:
The run destination iPhone is not valid for Running the scheme 'My Watch App'.
To use Apple Watch for development, enable Developer Mode in Settings → Privacy & Security.
I turned on the Developer Mode setting, restarted Xcode, waited for a bit and it started working again.
Make sure your Xcode is up to date.
This might sound obvious. I tried all the answers presented in this threat and nothing would help. I used Xcode 12.0. After upgrading to 13.1, everything worked as expected.
I have an app created from sample code I found online. I hooked up my iPod touch 4G to my computer and everything worked fine, app ran.
Then I hooked up my iPhone 3G to the computer, established provisioning profiles, etc. In the organizer the device shows up as a green dot, so we're good. The name of the device is right there next to the run button so that's a good sign. But when I hit run it says "build succeeded" and then goes directly to "finished running on " but nothing shows up on the app!
I've tried this with several apps now and all work on iPod touch, but none on iPhone.
Devices are running newest operating systems, 4.2 for the iPhone, Xcode version is the newest.
I had a different question with more than likely the same answer
App built with Xcode 4.2 ios 5.0 crashing when installed on iphone with ios 4.3.5
I found the solution here
Is it possible to target older iOS versions when using Xcode 4.2 and iOS 5 SDK?
by mmorris
I had to do what he clearly explained and 1 more thing:
Set the compiler in the Project and Target Build Set to LLVM GCC 4.2
That got the app running on my older devices
I had problem to run on simulator not on device.
Tried above options but didn't work for me.
Finally, Just Resetting Simulator did the trick.
Make sure you are targeting the least iOS version and SDK that you can in the build profiles (targets, summary, Devices, Deployment target). Also, check the error console (All Output) at the bottom right and see if there's some kind of problem occurring.