iOS 12 Programming for Beginners
上QQ阅读APP看书,第一时间看更新

iOS device

If you do not have a device connected to the computer, you will see No devices connected under the Device section of the Device and Simulator drop-down menu.

As noted earlier, when we start building the Let's Eat app, you will have the option of using the simulator or connecting a device to Xcode. Using a device is slower; however, the simulator will not perform in the same way as a device will.

In the past, you needed to have a paid account to build your app on a device. Nowadays, you do not need a developer account to run the app on your device. Note that, if you decide to connect your device instead of using a simulator, you will need iOS 12 installed on it. Xcode 10 introduced the capability of connecting your phone wirelessly. We will look at the traditional way first and then we will go over how you can connect your phone wirelessly.

The following steps are only intended for those of you who do not want to pay for the Apple Developer Program at this time:

  1. Connect your iOS device via USB.
  2. In the drop-down menu, select your device (here, I have chosen Xclusive iPhone 6 Plus):
  1. Wait for Xcode 10 to finish indexing and processing. The indexing and processing may take a bit of time. Once complete, the status will say Ready.
  2. Run the project by hitting the Play button (or use command + R).

You will get two errors that state the following:

    • Signing for ExploringXcode requires a development team.
      Select a development team in the project editor.
    • Code signing requires a product type application in SDK iOS 12.0.

Ignore the specifics of these errors as they indicate that we need to create an account and add our device to that account.

  1. Now, in the standard editor, you will see under Signing that you need to add an account:
  1. Click on Add Account. If a Sign into Xcode with your Apple ID dialog box does not pop up, inside the Accounts screen on the bottom left, click on the + and select Apple ID:
  1. Then, when you click on Create Apple ID, you will be asked to enter your birth date, name, email, and password, along with a number of security questions. Make sure that you verify your email before you answer the security questions, otherwise you will have to come back to this screen and add your Apple ID again.

 

  1. Once you have finished all of the steps, you will see your account, as follows:

If you already have an account, then instead of seeing Add Account, you will see a drop-down menu with your account listed. If your device is not connected to this account, you might see a message asking if you would like to add your device to your account. Adding your device to an account is for testing purposes only.