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 video.
- [Instructor] Now let's look at the required steps for getting an app to run on your device. Step number one is to create a project that is not from the exercise files. That way it won't have any of my code signing content in the project. Once you've done that, select your project in the project navigator, and then select your target in the TARGETS area. It should be selected by default. Note that also you're going to have to run an iOS 13 device for this to work.
The reason for that is if you change your target to a lower operating system, the code in the default template for creating an iOS project will not run on an operating system older than iOS 13. So you have to make changes to the project for it to work. I'm not going to cover that in this movie or in this course. So with that said, choose your project, choose the target, then go to Signing Capabilities.
Here, you can leave Automatically manage signing checked, and under Team, click the drop-down and hit Add an Account. That's going to take you into Xcode Preferences Accounts. Log in here, and then after you've done all that you should be able to select your personal team from this menu. Xcode should also automatically generate a signing certificate for you as well. So after you select your personal team, you should see that it's generating the signing certificate.
Once you have all of that set up, under the TARGETS section, where you see iPhone 11, or whatever simulator you've been using up to the point, look for your device. It should be at the top. You might see a message like this, OS version lower than deployment target. It shows a message here that says that my phone is running OS 12.4.1 which is lower than the deployment target, so it won't run on my phone.
So for now, I'm not going to run it on my phone, but this is how you would do it, select your device, and then simply hit the run button. After a few seconds you should have your device unlocked, follow any instructions in Xcode, or on your phone's screen to be able to run the app and then it should show up. So that was a lot of steps so we'll review. In order to run on your device, the easiest way is to upgrade your device to iOS 13 first.
Then in Xcode Preferences, add your Apple account. It doesn't have to be a developer account already, it can be a regular Apple ID. Once you've done that, select your personal team in the Team drop-down, allow Xcode to generate the signing certificate, and then choose your device to run on and run the app on your device just like you ran it before.
- Advanced UI controls
- Creating alert controllers
- Displaying web content
- Creating a collection view controller
- Creating a custom data type
- Creating tabbed apps
- Importing and setting icons for your apps
- Publishing your app to the App Store