Testing your applications on a device is a fairly straightforward process, but there are a lot of requirements to get it working properly. See all the steps in this brief tutorial video.
- [Instructor] Let's say you want to actually run your application on a device. You can do that fairly easily. All you need to do is have an Apple ID. Once you've done that you just add that to Xcode, associate it with your project, and then you can run the app on your device. Let's take a look at how it works. Associate your Apple ID and password with Xcode by going to Xcode, Preferences. Under Accounts hit the Plus button, and login with your Apple ID and password.
Once you've done that you should then have your Apple ID showing in this list. After you've associated your Apple ID close Preferences, and then select your project in the Project Navigator. From there, choose your target underneath the Target section. So you should be on the General Tab showing this left area here with this button, and select your target. It should actually all be selected by default. Then make sure you have Automatically manage signing selected.
Change the Team to your name, and Personal Team if it's a personal Apple ID, and, of course, if you have an associated Developer account ID you can connect that here. I'll use my personal ID this time. You might need to change your Deployment Target to a lower version if your device has a lower version of iOS than the current version that ships with Xcode. After you've done that change your current device to your phone. The reason why my phone's showing here is because it's plugged in through a USB cable.
So if it's not plugged in plug it in now, wait a few seconds, and it should show up right here. After you've done that hit the Run button to run your application on your device. You might get this error when you try to launch your application. This is because of settings inside of your device. The instructions to resolve this are described here. You need to open up the Settings application, and go under General, Profiles & Device Management, select your Developer App certificate, and trust it.
So I'm going to do that on my device. I won't show that on the screen though. Once you've hit the button to trust the certificate hit OK, and then try running the application again. After you've done that you should then see the app on the device. Note that I'm tabbing over to QuickTime Player, and not the simulator. QuickTime Player has my device's screen on it, and here it is. This is my device running our application.
- Alert controllers and actions
- Sliders, progress bars, and switches
- Creating UI elements with code
- Displaying web content with Safari view controllers and WKWebView
- Creating collection view controllers
- Creating tabbed apps
- Publishing your app with App Store Connect