Baidu cloud push graphic tutorial IOS

1. First apply for a Baidu developer account http://push.baidu.com/fc

2. Create a new application and apply the configuration

3. Select the apple icon, select the development status for development, and select the production status for online

4. At this time, you can upload the development certificate. The uploaded file needs to be in the form of PEM. The following describes how to configure the certificate

*To create an app ID, the same company may use an app ID similar to com example.* This is a common app ID, but if you want to add the message push function to the app, you can't use the common ID, and you need to create a separate one.

First log in to IOS Dev Center, then enter member center, and then select certificates, identifiers & profiles, as shown in the following figure:

Then click any item in the red box below to enter the certificate interface, as shown below:

After entering the certificate interface, select app IDS in the identifiers selection on the left, and click the plus sign in the upper right corner to create appids, as shown in the following figure:

In the process of creating app ID, you need to check the push service, as shown in the following figure:

Enter the submission page, and the push service is in the configurable state, as shown in the following figure:

Click submit to the confirmation page, as shown below:

Click Done to go to the initial page, and then select the appid you created again, as shown in the following figure:

Select the Edit button in the figure below to configure the push environment, as shown in the figure below:

Then configure the corresponding push environment. Both personal and enterprise development environments choose to create development SSL certificate. Release environment for personal version and enterprise version. There are three publishing environments: 1 The in-house must be an enterprise development account (within the enterprise) (US $299). 2. Ad-hoc personal account or company account (US $99), but it is only used for internal testing (a total of 100 devices). 3. The online Appstore can only be a personal account or company account (US $99)), as shown in the following figure:

If you are adding a message push function to an existing app, open the original app ID and the push notification option. The process is the same as above.

7.2 creating and downloading certificates

After clicking the create certificate button, "about creating a certificate signing request (CSR)" will appear, as shown below:

Here, you need to stop making CSR files. The production process is relatively simple. Here is the production process. Open the MAC system software 'Keychain access', select' certificate assistant 'and' request certificate from certification authority ', and create CSR file, as shown below:

After generating the certificate, return to the "about creating a certificate signing request (CSR)" interface, click continue, then select the generated CSR file in "choose file", and finally click generate to generate the certificate. As shown below:

Now the certificate production has been completed. Download and double-click the "key chain access" program to open it. In the left column, select login above, select certificate below, and then select the certificate just opened. Remember not to expand it, and directly right-click to export p12, as shown in the following figure:

Save the file as P12 format, enter the password, as shown in the figure:

Finally, enter the terminal, go to the certificate directory, and run the following command to convert the p12 file into a PEM certificate file: OpenSSL pkcs12 - in myapnscert p12 -out MyApnsCert. PEM - nodes prompts that you need to enter the password. Just enter the password when p12 was exported.

At this point, the certificate you want to configure is configured, and you can upload the certificate.

5 is to download the official demo, open the developed demo, and add the API key of the application you just applied to the project

6. Start changing things in the project

1) Change the bundle identifier to the bundle identifier you configured

2) The bundle identifier in the plish file has also been changed

3) Build setting -- Coding signing -- provisioning profile description file to configure a

To create a provisioning profile, click the + button in the figure below to start creating a profile

Select the environment of the profile

Select the appid and developer certificate to create the profile, select the device, and finally generate the profile

Finally, download the profile and configure it into Xcode for development test

be careful. Look at your description file. If it works well, you can't receive push

7. Running, basic push is OK

8. After that, we will talk about the customized push content, and jump to the corresponding point interface according to the key = value in the advanced settings

Methods in demo

You can get userinfo in this method, which is the dictionary passed from our advanced settings. Use userinfo [@ "key"] to pass a value,

This method is the response of clicking OK and cancel

You can fill in the interface you want to jump to here

9. You can set the sound of reminder by yourself

Put an audio file in the project,

Must be in the following data formats:

•Linear PCM •MA4(IMA/ADPCM) • μ Law •aLaw

You can package them as AIFF, WAV, or caf files. The customized sound file time must be less than 30 seconds. If it exceeds this time, it will be replaced by the system sound.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>