Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode cannot run using the selected device

I am receiving the following error when I try to run my Xcode iOS project:

Xcode cannot run using the selected device. Choose a destination with a supported architecture in order to run on this device.

I have had this error for a while now. I was able to get around it by using an actual device instead of a simulator, but now that doesn't work either. I haven't changed a single setting in the project since creating it, all that I have changed is the code itself. This has also happened before and the only way I fixed it was to create a new project and start from scratch and now it is happening again from that. I am so frustrated! I have no idea what to do. What info do I need to provide to help diagnose this? I am using the facebook sdk 3.1 if that means anything.

Thanks

like image 999
linuxer Avatar asked Nov 06 '12 19:11

linuxer


People also ask

How do you choose a simulated device as a destination?

Select a simulated device For iOS, tvOS, and watchOS apps, you can choose a simulated device, under [Platform] Simulators, from the run destination menu next to the scheme menu in the toolbar.

Where is generic iOS device Xcode?

The Generic iOS Device, under the Build Only Device section of the Device and Simulator drop-down menu, is used for when you need to archive your app, which means that you are preparing your app for submission to Apple (either to the App Store or Test Flight).

How do I select a running destination in Xcode?

To run applications you write in Xcode on your iPhone or iPad, a few one-time-only setup steps are required. First, be sure Xcode is open. Select the menu sequence Window → Devices and Simulators. Then, connect your iPhone or iPad to your Mac using a cable.

How do I add another simulator to Xcode?

If you require a different version of the iOS simulator than is provided by your Xcode installation, you can download additional simulators in Xcode. Open Xcode and click Menu > Xcode > Preferences > Select Components, and then choose the simulator version you want to download.


2 Answers

Target -> Build Settings -> Build Options set the "Compiler for C/C++/Objective-C" - "Default compiler (Apple LLVM 5.0)" and the issue will be solved

like image 172
Artur Avatar answered Oct 24 '22 12:10

Artur


  • Clean up your project using Clean, Clean folders, Delete derived data.
  • Delete all schemes from 'manage schemes'. Recreate them, and build using any of them that contains a version of iPhone simulator (the one that worked earlier).

If that doesn't work, try this:

  • Clean up your project using Clean, Clean folders, Delete derived data.
  • Using your favourite editor, try clearing all the profile strings from your project.pbxproj file (the one that you see when you open your xcode project using 'Show Package Contents' command).

See below image - you must delete all lines containing 'Provisioning Profile' till the ; character.

  • Then restart xcode. Select the profile using automatic profile selector and build using an iphone simulator scheme.

enter image description here

like image 27
Nirav Bhatt Avatar answered Oct 24 '22 13:10

Nirav Bhatt