Talk about IOS development environment configuration again (2023-09-01 new)

        Regarding the development of IOS, you need to configure certificates, keys, management identifiers, function configurations, etc., which are very complicated and have been configured before. This time, because I bought a new M1 notebook, I am going to reconfigure it, and record it by the way, so that Inquire.

        If you want to develop IOS, you first need to apply for a registered account on the official website of Apple Developers , and you can only do it after paying, which is about 688 yuan per year. About registered accounts, etc., are out of the scope of this article.

        Official help document

1. Certificate type

type

use

Apple development

For Xcode 11 and later.

Run an iOS, macOS, tvOS, or watchOS app on a device and use specific app services during development.

Apple distribution

For Xcode 11 and later.

Distribute your iOS, macOS, tvOS, or watchOS app to selected devices for testing or submission to the App Store.

APNs Authorization Key

Generates a server-side token in place of the certificate requested by the notification.

Apple Push Service

Establish a connection between your notification service and APNs to send remote notifications to your app.

iOS development

Run an iOS, tvOS, or watchOS app on a device and use specific app services during development.

iOS distribution

Distribute your iOS, tvOS, or watchOS app to selected devices for testing or submission to the App Store.

Mac development

Enable specific app services for Mac apps during development and testing.

Mac App Distribution

Sign your Mac App before submitting it to the Mac App Store.

Mac Installer Distribution

Sign the Mac Installer package containing your signed app and submit it to the Mac App Store.

Developer ID App

Sign Mac Apps before distributing them outside of the Mac App Store.

Developer ID Installer

Sign and distribute the Mac Installer package containing your signed app outside of the Mac App Store.

Apple Pay

Decrypt App transaction data sent by Apple to merchant/developer.

business identity

Authenticates you to the Apple Pay server.

Pass Type ID

Sign and send credential updates in the wallet.

Swift signature

For Swift Package Manager version 5.9 or higher.

Sign Swift packages and package collections for distribution.

VoIP service

Establish a connection between your notification server and APNs to notify background VoIP apps of incoming activity.

WatchKit service

Establish a connection between your notification server and APNs to update ClockKit complications data.

Website Push ID

Sign site updates and send site updates.

Create a new certificate interface seen after logging in to the account:

2. Create a certificate

        During App development, you will create different certificate types corresponding to different environments . iOS, tvOS, and watchOS apps use the same set of certificates, while macOS apps use another set of certificates. If you're using Xcode 11 or later, you can create a unified development and distribution certificate for all platforms. With the development certificate , you can run your app on the device and use the app functions; with the distribution certificate , you can distribute your app for testing and upload the app to App Store Connect.

        Development certificates belong to individuals. In total, you can create two iOS development certificates and two Mac development certificates . In your developer account, the computer name is appended to the development certificate name (for example, , Gita Kumar (Work Mac)where  Work Mac is the computer name), so you can easily identify the certificate.

        Distribution certificates belong to teams, and each team can only have one type of distribution certificate (with the exception of Developer ID certificates). Only account holders or administrative roles can create distribution certificates (if you register as an individual, you are the account holder).

        Certificates can be created and revoked using Xcode or a developer account.

Before officially creating a certificate, you first need to create a certificate signing request () certSigningRequest Create a certificate signing request () .

1. Create a Certificate Signing Request (on your local computer): .certSigningRequest file

Open the keychain in the application

  1. Choose Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.

  2. In the Certificate Assistant dialog box, enter an email address in the User Email Address field.

  3. In the Common name field, enter a name for the key (for example, Gita Kumar Dev Key).

  4. Leave the CA Email Address field blank.

  5. Choose Save to Disk, then click Continue.

Notice:

        User email address: It is the email address when registering an Apple account.

The Key file is stored on the desktop, and the file name is: CertificateSigningRequest.certSigningRequest

2. Create a certificate (operate on the Apple developer website)

Select Apple Development:

After continuing, select the CertificateSigningRequest.certSigningRequest file generated in the previous step (on the desktop).

The certificates for development and production can be created in turn, and the results are as follows:

3. Create Identifiers

App ID

App ID  is a string composed of two parts, which is used in the preset description file to identify one or more apps from a certain development team. There are two types of App IDs: one is an exact App ID (for a single App); the other is a wildcard App ID (for a group of Apps).

Exact App ID  contains the full path to the Package ID. Wildcard App IDs  contain an asterisk as the last part of the search string for the corresponding bundle ID. Note: A precise App ID needs to be specified in order to submit your App to the App Store and use specific services.

        App ID  can identify the App in the preset description file. It is a two-part string that identifies one or more apps from a development team. There are two types of App IDs: exact App IDs for a single app, and wildcard App IDs for a group of apps. App features enabled in an App ID act as an allow list, making features available to one or more apps. You can enable App Features when you create your App ID, or you can modify these settings later. Precise App ID will have In-App Purchases enabled by default. Starting with Xcode 11.4, you can use the same App ID to build iOS, macOS, tvOS, and watchOS apps.

1. Create new Identifiers

Select APP IDs

select apps

after finishing:

4. Profiles

        Profiles are used to combine Certificates, Identifiers, and Devices to form a unified description file describing certificates and identifiers.

1. Create a development profile

After continuing:

Select the identifier created in the previous step to continue

Select the previously created certificate to continue

Select the mobile phone that needs to be connected and continue

Enter a description file name, and generate

2. Create a production (shelf) description file

Continue, the method of operation is the same as generating a development description file!

5. Install the certificate file locally

Download the certificate file created in the first step to create a certificate to the local. Download the certificate to your Mac, then double-click the .cer file to install it into Keychain Access. Make sure to keep backup copies of your private and public keys in a safe place.

The downloaded file is named: development.cer, double-click the .cer file to install it into the keychain access.

I get this error -25294 when installing:

After querying the information, it is found that the intermediate certificate WWDRCA*.cer of the Apple Global Developer Relations Certification needs to be installed.

List of Apple certificates: Apple PKI - Apple

The red part is the certificate we need:

We can download G3, valid until 2030-02-20. After downloading, click Install. After the installation is complete, continue to install the distribution.cer and development.cer certificates, and finally the installation is successful

Notice:

After testing, it is not possible to download G6, but it is possible to download G3. I don’t know why, so pay attention here.

Six, Xcode configuration

1. Create an account:

Open XCode (my version: 14.3.1), select settings

Then choose to add an account:

2. Manage Certificates

        Select admin and press Manage Certificates to manage (view) the certificate. If the certificate has been set up in the Apple background account, it will be automatically displayed here.

        

pay attention:

        If the certificate has been set up in the background, and it has already been displayed on the above, do not press the bottom +, otherwise the same certificate will be installed repeatedly, which will cause the app signature to fail.

        In case the above situation occurs, the solution is to:

1. Delete duplicate certificates in the background of the Apple account;

2. Delete duplicate certificates in the local keychain;

3. Re-open xcode to view it normally.

Guess you like

Origin blog.csdn.net/sensor_WU/article/details/132616991