There are some features of iOS apps that don’t work from the iOS simulator. Maybe you want to test how your application works with the device camera or send an SMS message from your application. For these examples and more you’ll need to test and debug your app using a real device.
This post will walk through how to run the Xcode simulator on your iPhone or other iOS device and show you how to fix some common errors you’ll see along the way.
How to select your iPhone as the “Simulator” Device
Simulator is in quotes here since this will create an actual app on your phone; it’s no longer a simulation. Open up a project in Xcode and click on the device near the Run ▶ button at the top left of your Xcode screen.
Plug your iPhone into your computer. You can select your device from the top of the list.
Unlock your device and (⌘R) run the application. You’ll see Xcode install the app and then attach the debugger. The application should pop up on your phone.
As is mentioned before, the major software tool that can help you build an iOS app is Xcode, an integrated development environment (IDE) for macOS. It allows creating applications not only for iPhone and iPad but also for Mac, Apple TV, and Apple Watch. In Xcode, the scene delegate and/or app delegate is added automatically for the default iOS app project template. What are these delegates for, exactly? What are these delegates for, exactly? In this tutorial, we’ll dive into the scene and app delegates in Xcode, and how they affect SwiftUI, Storyboards and XIB based UIs. In the Xcode project, right-click the info.plist file and select Add Files to “project name” menu item. Select the iOS app icon image file, and check the Create groups radio button. Click Add button to add it. Now the logo.png file has been added to the project, you can see it in the left panel project navigator files list. Xcode Xcode is a complete developer toolset for creating apps for Mac, iPhone, iPad, Apple Watch, and Apple TV. Xcode brings user interface design, coding, testing, debugging, and submitting to the App Store all into a unified workflow. Downloading and updating Xcode. Use an on-demand cloud Mac server to develop iOS, macOS, watchOS, and tvOS apps in Swift or Objective-C BUILD Combine the power of cloud Mac servers with Xcode's new indexing engine to speed up the building process by up to 50x.
Troubleshooting Common Errors
The first time I tried to connect my iPhone to Xcode it didn’t work. According to my best friend, Stack Overflow, I’m not the only one who has had issues. Let’s share the fixes to some common errors you might encounter.
“Signing Requires a Development Team”
Xcode requires that you’ve connected a Team to your project in order to run the simulator on a device. You can do this from the “General” tab of your Project Settings. As of Xcode 7 this can be any Apple ID.
Open the Team menu that currently says “None” and select your team. If you don’t have a team, select “Add an Account…” and create one with your Apple ID.
Xcode claims your device is locked when it isn’t
This fun bug has been happening since at least Xcode 6. There are a lot of potential solutions in this Stack Overflow post. Here’s what worked for me:
- Unplug your iPhone
Reset Location & Privacyon your iPhone. Found under
Settings >> General >> Reset
- Plug in your iPhone
Trustwhen prompted to
Trust This Computer
You can learn more about how trusting computers works from Apple’s support.
“iPhone is Busy”
The unsatisfying answer for this one is to just wait.
If you don’t have a sword fighting partner, you can try the following:
- Unplug your device
- Restart both Xcode and your iPhone
- Plug in your device
That worked for me, but a lot of folks had luck with “Solution #3” from this Stack Overflow post.
Activate your Debugging Superpowers
The Jasonette docs FAQ has some more tips if you have other related issues. Now that you’ve got your application running on a device you can make the most of your testing and debugging experience with these tips:
If you have any questions or run into any other issues, feel free to reach out to me on Twitter @kelleyrobinson.
I wish I had known this when I first started because I delayed myself for 3 years before biting the bullet and buying a Mac.
Had I known about running Xcode on Windows or about the solutions below, I might’ve started building iPhone apps much earlier!
Rent a Mac
Before committing to buying a new Mac, you can actually “rent” one for development. You’ll remotely access the Mac and Xcode through your PC.
It’ll be like having the Mac desktop in a window on your Windows Desktop.
The really nice thing about this option is that the cost is really low and it’s the fastest option to get up and running.
If you decide that app development isn’t for you, you just cancel your plan.
These guys were featured in the recent Apple keynote when they introduced the updated Mac Mini! They have the newest Macs available.
(Use coupon code “CODEWITHCHRIS” for 50% off your first month. If you do, please let me know in the comments below. I’ll get a small kick back at no extra expense to you so thank you for supporting my site!)
If you go down this route for iOS app development, make sure you get my Xcode cheatsheet with references and keyboard shortcuts for Windows users.
There are a couple other companies that provide this service:
Xcode Ios App Getting Started
This is the most well known service out of the three. You won’t have to install Xcode because it comes preinstalled. You can also do pay-as-you-go so it’s a pretty low commitment. Some people complain that it’s slow but you can try it out for yourself since it’s only about a buck an hour!
XcodeClub is run by Daniel who is a passionate developer himself. From the reviews I see, the service is fast and friendly. The pricing is less flexible than MacInCloud and you’ll have to commit to at least a month.
If you’re a little more technically savvy, you can use virtualization software and run a “virtual Mac” on your PC.
The services above are essentially doing the same thing on their servers and then they charge you a fee to access the virtual machine.
By setting it up yourself on your own PC, you essentially cut the middle man out of the equation.
Unfortunately it does take a little bit of technical know-how to get this up and running.
The two most popular pieces of software to do virtualization are VirtualBox and VMWare Workstation.
You can download them below and then use Google to find a guide on how to install the latest MacOS (Mojave) with either VirtualBox or VMWare Workstation.
After that, spin up your new virtual Mac and download Xcode. This is as close as you’ll get to running actual Xcode on Windows!
VirtualBox is open source software which means that it’s free. That probably explains why it’s a lot more popular than VMWare Workstation when it comes to running MacOS on your Windows machine!
5. VMWare Workstation
Unfortunately you’ll have to pay for this piece of software and at the time of this writing, a license costs about half the price of a brand new Mac Mini which is perfectly suitable for iOS app development. I would recommend you try VirtualBox first or try to buy a used Mac Mini.
Build a “Hackintosh”
You can also build a “Hackintosh” which is a PC that has been customized to run MacOS.
This requires the most effort out of all the options presented so far but it can work for someone who wants a separate physical computer running MacOS.
A great resource for all things Hackintosh. The first How-To section contains links to a number of great tutorials for building your own Hackintosh and installing High Sierra.
7. Hackintosh Subreddit
I love looking for Reddit communities on anything that I’m interested in because there are always interesting conversations happening. Reddit provides a way to have a dialogue with like minded individuals, to get help and to help others!
8. Hackintosh Articles on 9to5mac.com
I included this link because it contains up to date news and articles for Hackintosh builds.
Third Party Solutions
Lastly, there are many third party solutions that you can use to do iOS development on Windows.
Xcode Ios 14.5
You won’t be using Xcode in these solutions but you’ll be able to generate an app that can run on iOS devices.
Check out these great Xcode alternatives:
9. React Native
Use C# to build a mobile app that you can deploy natively to Android, iOS and Windows.