Ios push implementation

Source: Internet
Author: User

The following two reference links of the certificate are very good:
 

Note that the warning notification is actually displayed by yourself. The specific process is as follows:


And push messages have their own unique json format, apple's api said very clearly: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW10
{
"Aps": {"alert": "Message received ed from Bob "},
"Acme2": ["bang", "whiz"]
}
Find an Open Source apple push server: https://github.com/stefanhafeneger/PushMeBaby in github
Easy to use
1. Import your cer file (p12 file not required on obj c) to the project.
2. Modify the initialization statement
-(Id) init {
Self = [super init];
If (self! = Nil ){
Self. deviceToken = @ "94b77ce5 bca83eb2 af0b0827 a7bbs633 3efc6ffdd e4fdw20a dd8cd2d7 5222c2e2 ";
// Set device token,
-(Void) application :( UIApplication *) application didregisterforremotenotifswswithdevicetoken :( NSData *) The deviceToken obtained
Self. payload = @ "{\" aps \ ": {\" alert \ ": \" This is some fancy message. \ ", \" badge \ ": 1 }}";
/// Set alert information
Self. certificate = [[NSBundle mainBundle] pathForResource: @ "aps_development" ofType: @ "cer"];
// Set the certificate path
}
Return self;
}
3. Run

Good luck

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.