Xcode Doesn't Recognize My Device After OS Upgrade - xcode

This has to be a simple configuration issue, but I don't know my way around the build settings very well.
I upgraded my iPad from 4.3 to 5.0. I am using Xcode 4.2. When I plug my device in, it is not showing up on run button, and I have a message that it can't run using the selected device.
What do I have to do?

Open Xcode, go to Window -> Organizer and find your device. Click the "Use for Development" button to get Xcode to recognise it again.

go to your iphone device, settings->Reset->Reset All Settings. Close Xcode, restart XCode, device should be in the list now.

Restarting USB process worked for me.
Run sudo pkill usbmuxd on terminal
or
Open Activity Monitor and select Disk by tapping from segment control and search usbmuxd, select the same and force quite/quite.
Note: before doing above stuff, remove device and quite Xcode.

Related

Xcode 12.3 keeps freezing

I updated to the latest AppStore release of Xcode (12.3, 12C33).
It worked fine for an hour or two. After that it started to constantly freeze after being open for a few seconds to minutes.
I've tried the following, all without success so far:
restart macOS
clear derived data
tried with different projects
updating to latest macOS 11
Any other ideas or suggestions how to fix this?
Update
I can confirm that this is fixed in Xcode 12.5
I found an answer by Darr on the question "Xcode freezes after upgrade to 12.3" on Apple's developer forums that worked for me:
Unpairing my device connected via network and using only lightning cable seems to have resolved the issue for me.
Xcode > Window > Devices and Simulators > device > Connect via network
After going mad, I fixed this by removing all devices from Devices and Simulators (I had connect via network activated).
For now, it's working fine.
Power off your Apple Watch
Xcode may hang if the host Mac is connected to an iOS device which has one or more companion watches. The hangs occur when the watches aren't fully prepared for development, or if they are experiencing poor wireless connectivity. (72490921) (FB8945320)
Workaround: Power off the watches, or unpair them from the iPhone.
Xcode 12.4 Release Notes
You can force Xcode to freshly prepare a watch for development using these steps:
Force-quit Xcode.
Power-off and disconnect all iOS device from the Mac.
Reboot the Mac.
Launch Xcode, close all projects, and open the Devices and Simulators window.
Power-on and unlock an iOS device and its companion watchOS devices by entering the passcode as required.
Plug the iOS device into the Mac using USB cable.
Check each iOS device and each watch for any pairing request and approve the requests.
Monitor the status of device preparation in the Devices and Simulators window. If Xcode presents device-preparation errors, follow the guidance in the error message to resolve the error.
Once Xcode finishes preparing the iOS device and its companion watches for development, repeat steps 5 through 8 for each remaining iOS device and its companion watches until you verify that Xcode has prepared all devices for development. You may now open your Xcode projects and resume development.
I've been having the same problem. I had an iOS device connected via USB, unplugged it and it un-froze. Then I continued to have issue requiring force close each time.
I then clear derived data and things have been fine. I opened a StickerPack project and also had the same issue. Clearing DerivedData also fixed it.
Clear Derived Data:
Xcode pulldown menu > Preferences > Locations tab
Click the little arrow next to the path under Derived Data.
Delete the entire folder for you project. It will look like "MyAppName-bwonddotztrgkkfexrjxoncvmjit"
See this explanation about whether it's safe to delete DerivedData for your project.
I had the same problem with appstore version and someone advised to install from site, now it works fine. https://developer.apple.com/download/more/
Disable WLAN on my iMac fixes the problem currently.
Hope they will releast a fix very soon.
Xcode 12.3 is unstable and many times it crashes.
I reverted back to Xcode 12 and copied disk image of 14.3 in Device Support folder of Xcode (Contents > Developer > Platforms > iPhoneOS.platforms-DeviceSupport).
This I needed to debug on iPhone device having version iOS 14.3
https://github.com/mspvirajpatel/Xcode_Developer_Disk_Images/releases
I recently had similar situation. My Xcode 12.3 project could not be opened. I tried to open directly from popup that appears on start of the Xcode.
What worked for my was to downgrade Xcode to 12.2 and launch Xcode on new project. And then click my old one.
Maybe it would work without downgrading but I didn't check.
I had this problem too. I fixed it by going Devices and Simulators in the Windows file and disconnecting the iPhone reference I had for my phone when testing and app. Since the phone was no longer connected, its presence seemed to create a freeze.
In my case XCode 12.5 hangs/freezes on startup more or less instantly, right after it opens kind of an empty workspace.
I removed everything that I could imagine that deals with XCode on my machine, but it didn't help.
At the end I just used the hotkey for "Close Workspace" - Ctrl+Alt+Cmd+W
I hit this combo very often, very fast right after opening XCode and it worked!
The strange empty workspace showed up and closed instantly - now I could select other projects and everything works again.
There could be the multiple reasons and in my case reason was source control
preferences > Source Control > uncheck Enable source control
I have these performance problems with the newly updated Xcode from the AppStore to 12C33 (Xcode frozen for many seconds, instability of interface builder, etc.) only with apps which have frameworks added with cocoa pods and when working in the xcworkspace-file. (Integration of frameworks with Catharge even fail with error message 65). I'm running Xcode under macOS Catalina. Don't know what the technical reason could be, hence would appreciate if someone has an idea on this how to fix it.
Update: In the meantime I could fix it:
I eliminated my own devices from the device list and did then a deintegration and a new install of the cocoa pods for the projects. Afterwards I setup my devices again in the device list and all worked well again. Only eliminating and reintegration of my devices as described above didn't work in my case.

Trouble pairing Apple TV with Xcode

When trying to pair Xcode with my Apple TV it says
This device has been ignored in the devices panel.
I cannot continue development properly until this issue has been solved, however I cannot find an un-ignore button. Please help me, thank you!
Running the terminal command as described in other answers didn't work for me and the device kept being ignored whenever I re-opened Xcode.
My solution was to open Apple Configurator and go to Paired Devices on the About menu. From the window that appears hit the X to remove all the devices (I had the same device listed 6 times).
Then close Apple Configurator, launch Xcode and the Apple TV paired.
My setup was Xcode 13.4.1 / Apple 4K 2nd Gen / tvOS 15.5.1 / Apple Configuration 2.15.1
2022
While Window > Devices and Simulators is open on the Xcode, go to the upper menu with the back button on your remote and re-enter the Remote App and Devices menu to try to go back again. Try a few times. It'll show your device on the Xcode's Device window. Then click the "Pair" for the device. You’ll see a screen asking you to enter the six-digit code displayed on your Apple TV; enter the code to the Xcode's Device window. And wait for it. For a while device and Xcode will work for Preparing debugger support for your device. Keep your Mac device and Apple TV close until it's done.
Hope this will help someone.
Best.
I think I found the solution. I did a number of things so here are all of them, but the most important one is step 5:
Go to main menu in Apple TV
Quit Xcode
Go to the command line and type
defaults read com.apple.dt.Xcode.plist DVTIgnoredDevices
You should be able to see the AppleTV in question listed there.
NOTE: This will clear all of your ignored devices
. Still in the command line, type
defaults delete com.apple.dt.Xcode.plist DVTIgnoredDevices
Go to the Devices and Simulators window
On command line, type
defaults read com.apple.dt.Xcode.plist DVTIgnoredDevices
You should see something like "does not exist"
You should be able to pair the AppleTV now
2022
After testing some solutions and having no luck, try the next:
Restart the router
It's working now.
Try it.
I had exactly the same issue:
My solution was:
Remove everything from the ATV
perform the delete command from above
Reboot everything!
Try the pairing again
This did it for me.
For some reason, don't ask me why
Make sure you've enabled the "Show as run destination" option.
i tried all the solutions mentioned here - non helped, eventually i:
selected "Forget Device" from the apple tv
restarted the apple tv
closed the XCode
restarted mac
paired again and that worked
sometimes when you press |Pair| button in the Devices & Simulators window, after you key in the numbers, the screen will go back to "Pair" mode,
in order to bypass this issue, after pairing i restart the xcode (without unpairing or forget the device), and the device shows up as connected
I was having the same issue and none of the solutions above worked. Then I noticed that universal clipboard between my iPhone and Mac was also not working.
The solution for that was to toggle Bluetooth and Wi-Fi on/off on both Mac and iPhone (I have a feeling that it was more the toggle on Mac that helped).
Anyway, by fixing that issue, my AppleTV showed up paired and ready to use in Xcode (din't even have to re-pair).

Xcode: iOS Simulator Dev Menu will not open

Specs: React Native, xCode, iOS Simulator
I'm currently running xCode and just trying to start my hello world however despite numerous approaches I cannot get the dev menu in the iOS Simulator to open. The hotkey CMD + D will not work.
I have tried:
I checked and unchecked the simulator keyboard settings, “Connect
Hardware Keyboard”. Reference
I have tried “Reset Content and Settings” in the simulator menu.
Switching between scheme settings for the project. “Check your
scheme settings. The current scheme shows at the top of Xcode. Click
on it, then Edit Scheme. Under "Run", make sure the build
configuration is set to Debug. If it's set to something different,
you won't get the dev menu.” Reference
Restarting the simulator and restarting my mac.
Let's you try command + control + z
I also faced the same issue and after searching a lot I finally got a solution.
Create a fresh project by react-native init and see if it(dev menu) works or not? If it does, just upgrade the react-native version of your project. In my case, creating a fresh project worked.
I faced a similar issue when the default launch device as iPhone 11. But when I ran the command to run with iPhone 11 Pro developer menu came back. May be specific to a device on my machine.
https://reactnative.dev/docs/running-on-simulator-ios
"react-native run-ios --simulator='iPhone 11 Pro'"
To list all devices
xcrun simctl list devices

Xcode not detecting my device

I upgraded my iPad device OS version recently to 5.1.1 (9B206). From that my Xcode is not detecting my device. Am just getting iOS Device and simulator options in my Xcode. But am getting my device in older version of Xcode and iTunes. For this i updated my MAC OS version to 10.7.4 and Xcode version to 4.3.3. But still am facing the same problem. Now how to make my Xcode to detect my device?
This Worked for me.
Quit Xcode.
Disconnect the device.
In a terminal window, type: sudo pkill usbmuxd (it will be restarted
again automatically)
Restart Xcode
Connect the device
Your device should now be visible again in Xcode!
Open the Organizer in Xcode, go to devices, find your device and click the option to use for development
I just plugged into another USB port and it detected by device.
In another case, check the "iOS Deployment Target" in "Build Settings",
if the target iOS version number is great than the version of device,
then the device will not show in the list.
Say that, the "iOS Deployment Target" == 7.0, and the version of device is 6.0,
to solve the problem by change the "iOS Deployment Target" to 6.0 or lower.
If the chosen answer still does not work for you try this:
Select the project in project explorer
Select the target on the main window
Select Build Settings
Select Deployment
Select iOS Deployment Target. Change it to the version of your device. (e.g. iOS 5.1)
I was also faced the same issue in Xcode, my device was not detected after update the Xcode latest version(7.3.1)
Done so many things what suggested in the web-search but still the device was not detected.
Finally, I just quit and open the Xcode my device was detected(oh my bad).
This SO answer solved it for me https://stackoverflow.com/a/56054170/5813473 .
sudo killall -STOP -c usbd
did the magic.
Well later I had to unplug/plug in again at occasions, but that 'killall' really solved the original issue.
Most recently, Xcode 8.3 and iOS 10.3 seems to have more security around Xcode accessing the iPad/iPhone. My sequence:
Rebooted the machine,
Attached the iPad,
Gone through a "trust this computer" security cycle on both iMac and iPad
Xcode can now see the device
Sometimes restarting Xcode helps. Give it a shot.
In my case, restarting Mac worked and no other solution.
I updated my iPad (it's in Settings -> General -> Software Update, near the top) and restarted my computer and Xcode sees it now.
FWIW I tried all the tips in this thread and nothing would work: from reboots, command line statements, unplugging, different USBC ports, etc. I also tried something not mentioned here (yet) by going to "Settings > General > Reset > Reset Location & Privacy" ... however even this didn't work.
Later on in the evening I was in a different room of the house and out of nowhere I got the "Trust This Computer" prompt on my iPad. I of course tapped "Trust" or whatever and then magically my Mac laptop finally sees my iPad.
I realize I'm not really giving a helpful tip/fix here - just sharing how things went for me in case anyone finds useful.
iPad: iOS 13.4.1 | Macbook laptop: OSX 12.3.1
Recently (2022) I've noticed that the iPad prompt to "Trust this Computer" won't appear unless using an Apple USB-C cable. Apple reps assure me they aren't doing any funny business here, but I have tried every cable I can find, including several thunderbolt 3 and 4 cables and Anker cables. Worth trying an Apple cable if still having problems.
Just simple, close the project on your XCode. Just right-click on the XCode in the taskbar and give a quit option. After open the XCode from the directory, it will detect your device. It also work on Xcode version 11.2.1
close your project or XCode.
Give Right click on the Xcode in MAC tabbar and give the Quit option.
Reopen the project from your finder(project place).
The device will be automatically detected.
Open the Windows in Xcode, go to devices. If Device is visible in Left side, Right click and select "Show in Destination Menu".
Enjoy..

How to run iPhone emulator WITHOUT starting Xcode?

On my old Mac running Snow Leopard, I could type "ios" into spotlight and it would start up the iPhone/iPad emulator by itself.
I have since had to get a new machine running Lion. I have installed Xcode for Lion, I have installed the developer tool options from the preferences panel.
But the "ios" option is no longer there :( The only way now seems to be to run Xcode, create an empty project and then launch emulator with the run option.
I have searched and searched the intertubes and the facewebs, but nothing helps.
Does anyone know how to run only the emulator on Lion?
UPDATE:
THIS IS RESPONSE TO #ike_love thread below.
THAT answer is not assured to work on all Yosemite machines.
Assuming you have Xcode installed in /Applications, then you can do this from the command line to start the iPhone Simulator:
$ open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
(Xcode 6+):
$ open /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app
You could create a symbolic-link from your Desktop to make this easier:
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ~/Desktop
(Xcode 6+):
$ ln -s /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app ~/Desktop
As pointed out by #JackHahoney, you could also add an alias to your ~/.bash_profile:
$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/De‌​veloper/Applications/iPhone\ Simulator.app'
(Xcode 6+):
$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app'
(Xcode 7+):
$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app'
Which would mean you could start the iPhone Simulator from the command line with one easy-to-remember word:
$ simulator
The easiest way without fiddling with command line:
launch Xcode once.
run ios simulator
drag the ios simulator icon to dock it.
Next time you want to use it, just click on the ios simulator icon in the dock.
In XCode 7+ the location is now
/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
Run it from the command line
$ open -a Simulator
From Terminal you have to run:
open -a Simulator
No need to do anything on the commandline.
Just use spotlight to run simulator.app
is it helpful to you see the image
Edit
Now with new Xcode if the icon of the Xcode is on dock you can just right click it and form the menu you can select Open Developer Tool and in the sub menu you can select the iOS Simulator to open the simulator without opening the Xcode.!
You can get it to launch via spotlight if you create an Automator launcher for it:
Open Automator.app
Choose type of Application
Select Actions > Library > Utilities > Launch Application
Open the dropdown of applications that can be launched and choose Other
You can't directly select the Simulator app because it's inside the Xcode.app package. So instead you'll have to navigate to it in a separate Finder window and drag it onto the file selector window. It will be at one of the following paths depending on your version of Xcode (oldest to newest):
/Applications/Xcode.app/Contents/Developer/iOS Simulator.app
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iOS Simulator.app
/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
Finally, save this Automator app in your applications folder as iOS Simulator.app
To get a nice icon for the Automator app you just made, you can do the following:
Right click iOS Simulator.app and choose Get Info
Click the icon in the upper left corner and do Cmd-C to copy it
Right click your Automator app and choose Get Info
Click the icon in the upper left corner and do Cmd-V to paste
As the multitude of answers indicate, there are lots of different ways to address this issue. Not all of them address what is my number one issue, and what seems to be the asker's priority, as well: The ability to launch from Spotlight.
Here's the solution that works well for me, and should work with any OS X and XCode versions. I've tested it on OS X 10.11 and XCode 7.3.
Initial setup does require launching XCode, but after that, you won't need to just to get to the Simulator.
Setup
Launch XCode
From the XCode menu, select Open Developer Tool > Simulator
In the dock, control (or right) click on the Simulator icon
Select Options > Show in Finder
While holding down Command and Option, drag the Simulator icon to the applications directory. This creates an alias to it.
If desired, rename the alias from "Simulator" to "iOS Simulator". Whatever you name it is what it will show up as in Spotlight.
Note: There are other ways to get to the location of the Simulator app (steps 1-4), such as using Go to Folder… in the Finder, but those require knowing the location of the Simulator to begin with. Since that has changed from version to version of XCode, this way should work regardless of these changes.
Use
Launch Spotlight (command-space, etc.)
Type "simulator" or "ios" (if you renamed the alias).
If necessary, use the down arrow to scroll to the Simulator alias. Eventually, spotlight should learn and make the alias the top choice so you can skip this step.
Hit return
Try below instruction for launching iphone simulator:
Goto Application Folder-->Xcode app-->right click to Show Package Contents-->now show files in xcode contents-->Developer-->Platforms-->iPhoneSimulator.platform-->Developer-->Applications--> now show iOS Simulator app click to launch iphone simulator...!
With Xcode 6 the location of the simulator has changed to:
/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app
It can no longer be found here:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app
I hope this helps someone since I sometimes want to start the simulator from terminal.
The solutions above didn't work for me in ZSH. I needed to escape the dot in the iPhoneSimulator.platform. This works for me:
alias simulator="open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app"
This could be even more resilient version:
alias simulator="open -a 'iOS Simulator'"
There's a far easier way:
Hit command + space, Spotlight Search will appear
Type in iOS Simulator and hit return
Done.
----- In follow up to #E. Maggini downvote---
Yes you can still easily access iOS Simulator using Spotlight.
In the terminal:
For Xcode 9.x and above
$ open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
For Xcode-beta 9.x and above
$ open /Applications/Xcode-beta.app/Contents/Developer/Applications/Simulator.app
I know it is an old question, but this might help someone using Xcode11+ and macOS Catalina.
To see a list of available simulators via terminal, type:
$ xcrun simctl list
This will return a list of devices e.g., iPhone 11 Pro Max (6A7BEA2F-95E4-4A34-98C1-01C9906DCBDE) (Shutdown). The long string of characters is the device UUID.
To start the device via terminal, simply type:
$ xcrun simctl boot 6A7BEA2F-95E4-4A34-98C1-01C9906DCBDE
To shut it down, type:
$ xcrun simctl shutdown 6A7BEA2F-95E4-4A34-98C1-01C9906DCBDE
Alternatively, to launch a simulator:
open -a simulator
Source : How to Launch iOS Simulator and Android Emulator on Mac
The easiest way is to use Spotlight Search. Just click CMD+Space and type in search Simulator. Just like this:
And in few seconds emulated device will be loaded:
To switch to another device you can use menu under Hardware -> Device
There are few different cool instruments you can use under Hardware menu, such as orientation change, gestures, buttons, FaceID, keyboard or audio inputs.
Go into Finder.
On the sidebar, click applications.
Find Xcode in Applications.
Right click Xcode by whatever settings you have (usually two finger click [not tap]).
Click "Show Package Contents."
Go into the Contents folder.
Search simulator.
Wait 30 secs for it to load.
Scroll down and find iOS Simulator.
You may drag this onto the dock for easier access.
I hope this helps!
In case you were trying to open multiple distinct simulators at once:
Open the Simulator app, not Xcode.
Then File >> Open Device >> Select iOS version >> select device.
The location of the 'open device' has changed in different Xcode versions so it may be at a different place
I created an automator app based on #trojanfoe's answer so you can launch iOS Simulator directly from your Dock https://github.com/tsdexter/ios-simulator-expo-utilities/
From Terminal just run this command:
ios-sim start
Or,add this to your ~/.profile to save yourself a few keystrokes:
alias ios="ios-sim start"
Not sure which version of Max OS X and Xcode this command became available. I'm running 10.10.3 and 6.3 respectively.

Resources