This two-day study of the iOS push mechanism, below describes the next homing pigeon push:
Application Configuration
- First enter the carrier Pigeon, create an app, then click on the App list in the console: for example:
- Click Apply configuration, the application configuration interface appears:
- In the development environment, add a test device:
When the mouse moves to the test device when the Change button appears, click the button, the Add Device interface appears: (Device Token:udid)
- Add a publish and test certificate
Refer to the carrier's developer documentation, set up a certificate, if you have questions, you can refer to this link, is also the creation of a push certificate, write better: http://blog.sina.com.cn/s/blog_6afb7d800101fa29.html
After the certificate is set up, 打开终端,找到项目所在目录 (must be in the corresponding directory, the original when I verify the root directory, has been error, cannot find the file, later found that it should be verified in the project directory!! ) To verify that the certificate is legitimate:
Development Certificate: OpenSSL s_client-connect gateway.sandbox.push.apple.com:2195-cert xxx.pem-key Xxx.pem
Test Certificate: OpenSSL s_client-connect gateway.push.apple.com:2195-cert xxx.pem-key Xxx.pem
After verifying the legality to begin uploading the certificate, the mouse slides to the development certificate, the production certificate back to the upload button, click the Upload button, the corresponding interface, upload can.
Access SDK
According to the access to the document, generally do not have any problems, in the development environment, set up a designated account,: (This account in the notification will be used when the development environment, set this account, to see if the specified device is notified, if it is the release environment, according to their own needs set)
Click on the notification to enter the appropriate interface, in the following method to achieve:
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo{}
At this point, the application configuration, the SDK access has been completed, finally can test send notifications!!
Send Notifications
In the Application Configuration screen, the left sidebar, click Create Notification, the Create notification interface appears:
As shown in the production environment and the development environment, the user scope of the production environment you can choose whether it is all or part of the account, the user scope of the development environment is a single account, account for 接入SDK the time in the appdelegate inside the account set, [Xgpush setaccount:@ "123456"];
, add to here, OK, fill in the corresponding content, click Send, when prompted, send notification success!
Problems encountered in the development environment
Always prompt when sending notification: Invalid account, please check if the certificate is correct.
I tried at the terminal, is correct, later found that the Project-general team chose the wrong, should choose the corresponding notification function ID, and then check the code signing profile, choose their own to create a notification function profile, run the program again, Send a notification and receive a push message.
Finally remind again, the certificate must be set correctly!!!
Homing Pigeon Push Step (iOS)