About this piece of content, in the online search post are older, see the post on the basic is Xcode6 before the iOS8 version of the age, for now more new iOS10.2 and Xcode 8.2来, knowledge points in the whole is still some not comprehensive, Just recently the project needs to do this piece of content, it is sorted out, convenient for later review.
Development environment
Hardware: MacBook Pro/iphone 7
Software: OS 10.11.5/xcode 8.2.1/ios 10.2.1
Certificate Request
If you need to do a remote push, the basic is the certificate application, Apple is not open source of the reason is the certificate this piece is more difficult to complicate, familiar with the future is nothing.
Let's start by listing some of the common Apple certificate files:
1.证书请求文件:CertificateSigningRequest.certSigningRequest;2.打包(真机测试)用的 开发证书 :ios_development.cer;3.上架用的 发布(生产)证书:ios_distribution.cer;4.开发测试用的远程推送证书:aps_development.cer;5.上架正式做远程推送的证书:aps.cer;6.开发用Provisioning Profile(PP);7.内测使用的的Ad Hoc 版 Provisioning Profile (PP);8.上架App Store 时用的Provisioning Profile (PP);9.以及使用开发用的远程推送证书制作的供后台服务端用的P12证书;10.和使用上架用的远程推送证书制作的供后台服务端用的P12证书;11. 关于9和10是针对部分使用JAVA开发的后台服务端直接支持p12文件证书的;如果部分(PHP开发的)服务端不支持P12文件的,还要再将P12文件转成Pem文件才能在服务端使用;
Certificates are basically these, can be divided into two major categories: development and release of the use;
Due to the application of the application certificate and the certificate is basically the same and the requirements are basically the same, so the following unified all the certificate application generation method;
1. Certificate Request file: production of certificatesigningrequest.certsigningrequest;
In the development process, the developer will first create a development certificate to debug the project, after the commissioning, the program app shelves to the app Store,
This is the time to replace the certificate with the publishing certificate (production certificate). Before you apply for all certificates, create a certificate request file called CSR;
1.1 Turn on the Keychain Access tool on your computer;
Keychain Access
1.2 Open the interface as follows: You can see the existing certificate files on the computer;
Keychain Access Home
1.3 Click on the toolbar: Keychain Access--Certificate assistant--Request a certificate from a certification authority ...
Create a CSR
1.4 In the pop-up window fill in the user email address and common name, select "Save to Disk", and then press "continue";
Fill out a free email
1.5 Choose Save Location Store, here choose Save on desktop;
Where to save
1.6 Click Finish, this will generate a CSR file on the desktop, standby;
Generate a CSR file on the Desktop 2. Development Certificate for Packaging (real machine test): Ios_development.cer application;
Open Apple Developer official website: https://developer.apple.com
2.1 Select Account;
Sign in to Apple Developer website
Enter the developer account and password login (note that only a paid developer account can apply for remote push and on-shelf services)
Login to Apple Developer account
2.2 After logging in, select Certificates, Identifiers & Profiles
Go to the Certificate Request page
2.3 Enter after click on the left column certificates--> all, the first entry has not any certificate, click on the upper right corner + add the certificate;
Create a developer certificate
2.4 Enter and select the type of certificate as required, here to apply for development certificate, so choose IOS App development; then pull to the bottom to press continue to enter the next step;
Apply for development certificate
2.5来 after the next step here to suggest that a CSR file is the first step of our CSR file, continue to click Continue;
Uploading CSR Files
2.6 Click Choose file to select the CSR files that were just generated on the desktop to import, and then continue to click Continue;
Uploading CSR Files
2.7 This time the development certificate is finished, click Download Download to the desktop, click Done to return to the first side of the certificate;
Generate a certificate and download
2.8 Certificate First page, this time has produced a development certificate,
Certificate Home
2.9 The desktop already has two certificate files:
On the Desktop 3. Release (production) Certificate: Ios_distribution.cer Application;
3.1 Follow the above steps, continue to create a release (production) certificate, in the 2.4 certificate type that step to choose the App Store and Ad Hoc, the other steps;
The finished certificate first page is like this, a development certificate, a publishing certificate;
Apply to publish a certificate
3.2 To open and download it to the desktop, when the desktop generated three certificate files;
On the Desktop 4. APP ID Request
Before applying for a push certificate, you need to apply an app ID to the developer account and then use that ID to create the project, or the
App ID is added here, every app with a remote push has a unique app ID number;
4.1 Click on the left column of the Identifiers-->app IDs, if not previously added then this is empty, click on the upper right corner + number to add the App ID number;
APP ID Home
4.2 Enter the new page after the request to fill out the description of the app ID name, this can be taken at will, as long as they remember the good;
Create App ID
4.3 pull down, to the bundle ID, create an ID according to the format (this is very important), this ID number is later used in the project, the same as the project ID number;
Create App ID
4.4 Pull down, turn on push service (important), point continues
Turn on the push service
4.5 Register Registration, if the completed app ID is not occupied, the registration is successful;
Register App ID
4.6 Back to the App IDs page, you can see that the ID number you just created has been created successfully.
Successfully created app ID5. Remote push certificate for development testing: Aps_development.cer Application;
Apply for a good App ID after the start of the production of push certificates, push certificates are also divided into two, one is the test of the push development certificate, one is on-line use of push release (production) certificate;
5.1 Below apply for push development certificate; Continue to the previous step, click to create a built app ID, pull to the bottom, click Edit;
Request a push development certificate
5.2 Pull to below, you can see the top and bottom respectively for the development of certificates and publish certificates, here first apply for development certificate, click on the first column of Create Certificate ...
Request a push development certificate
5.3 The following request to upload the CSR file, is also the first step to generate the CSR file, select Upload, and then next;
Import a CSR file
5.4 Then the next step, the production is finished, click to download to the desktop;
Certificate Home
5.5 The desktop already has 4 files:
Desktop Files 6. On-shelf official remote push certificate: Aps.cer application;
6.1 Follow the previous steps, choose to publish a push certificate when creating a certificate, create a push certificate for the publication, and download it to the desktop;
Apply for push distribution certificate
6.2 The desktop already has 5 files:
Desktop Files 7. Adding a debug device to a test user
If it is to develop a package for testers to debug push, you need to add the test user's device to the account, only the added device can install the test package, need to use the device's UDID number;
7.1 Click on the left column devices--> all, tap the upper right corner + sign;
Add a Device
7.2 to the need to add the device to take a name, its only udid number, and then click on the registration can be, the personal account can add up to 100 devices;
Add a Device
Specific equipment Udid How to obtain can refer to the article: Https://www.pgyer.com/doc/view/udid
7.3 You can also connect your device to your computer on itunes to get:
Application and production of Udid8.provisioning Profiles (PP) in Ituns acquisition equipment
Development of the PP file can only be used to test the real machine (Xcode directly into the phone), and now can be the same as ad hoc installation on the specified device, but the way out of the package using COM + B debug;
and ad hoc's packet-out method uses archive release to package;
The APP store's PP package is also archive Release, but can not be installed on any mobile phone, can only be used on shelves;
Because three kinds of PP production method is quite, so together speak;
8.1 For the package to make a provisioning Profiles file, click on the left column provisioning Profiles under the development on the right click on the + number to create;
Production of PP for development
8.2 To this step according to the requirements of choice, here first create an internal test with the PP file, select ad Hoc and then click Next;
Making ad Hoc PP
8.3 Select an app ID, select the app ID to install the app, and choose Next;
Select App ID
8.4 Select the published certificate of the previous application (only when making PP for development, select the development certificate, the other two are the distribution certificate);
Select Certificate
8.5 Check the device you want to install the test application on: (Note here: Before you choose to create the App Store version of the PP type, there is no following this step)
Select Device
8.6 Give this pp file a name, then complete and download to the desktop;
Give PP a name
In the same vein, make a PP for development and PP for on-line, and select development and App Store to download it to the desktop when you create it.
8.7 Then the desktop has the following certificates:
Desktop Files 9. The production of P12 certificate
P12 is also divided into the use of development testing and formal distribution after the use of two, the same as the production process, as described below;
9.1 These certificate files on the desktop, double-click to install into the keychain (double-click separately), and then open keychain Access: Select Login-My certificate:
Find the push development certificate and push release certificate respectively, right click to select Export;
Export the push development certificate
9.2 Take an appropriate name, format select "Person information exchange (. p12)" and then point to store;
Export P12 File
9.3 Then pop-up dialog box, ask for encryption password, set a password, and remember that one will be sent to the background developers;
Set P12 password
9.4 Similarly export push release certificate P12, then the desktop has so many certificate files;
Desktop Files 10. Convert P12 files to Pem
Depending on the server development language, sometimes you need to convert the P12 file to PEM, although this step can be turned over to the background, but sometimes we also need to test, then how to turn?
Open terminal, CD to P12 location, to the next command to go
openssl pkcs12 -in Push.p12 -out Push.pem -nodes
The P12 file or Pem file together with the password will be sent to the backstage after the transfer.
11. Certificate Usage Instructions
Send two P12 files to the server developer and tell them the password that was added when exporting the P12; The server developer uses the development P12 file or PEM file when debugging, and then replaces it with the published P12 file or PEM file when the item is on the shelves;
Three PP files are packaged in project engineering, packaged test packages Ad_hoc (Archive release) or development (Com + B Debug), on-shelf app Store with App_store (Archive release) Version.
[Go]ios 10.2 XCode 8.2 Certificate Request remote Push pack Shelves