IOS push notification usage

Source: Internet
Author: User

Push notificationUsage:

 

ReferenceResources:

Http://tiny4cocoa.com/thread-1406-1-1.html

Http://bbs.ldci.com.cn/read.php? Tid-19971.html

Http://www.cocoachina.com/bbs/read.php? Tid-3770-keyword-apns.html

Http://code.google.com/p/apns-python-wrapper/

Http://urbanairship.com/

Http://urbanairship.com/docs/getting_started_ios_push.html

CustomerUserTerminal:

ProgramUpper AccuracyBackup: Device token requiredPass to provider

-(Void) Applicationdidfinishlaunching :(Uiapplication*) Application {

[WindowAddsubview: Viewcontroller.View];

[WindowMakekeyandvisible];

Nslog(@ "Registering for push notifications ...");

[[Uiapplication Sharedapplication]

Registerforremotenotificationtypes:

(Uiremotenotificationtypealert|

Uiremotenotificationtypebadge|

Uiremotenotificationtypesound)];

Application.Applicationiconbadgenumber=0;//Program DevelopmentStart, SetUiremotenotificationtypebadgeMarked0

}

 

-(Void) Application :(Uiapplication*) App didregisterforremotenotificationswithdevicetoken :(Nsdata*) Devicetoken {

Nsstring* STR = [Nsstring

Stringwithformat:@ "Device token = % @", Devicetoken];

Nslog(STR );

}

 

RequiredRequiredThere isPp id,And alreadyJingOpenNotificationFunction. Provision requiredMust be re-established (after the notification function is enabled in the app ). Delete the original provision and import the new one.

 

Preparations on the server:

 

Using this library, you can simply build a server:

Http://code.google.com/p/apns-python-wrapper/

TestGenerationCodeAs follows:

 

#! /Usr/bin/ENV Python

From Apnswrapper Import *

ImportBinascii

Devicetoken=Binascii.Unhexlify('Authorization');

Wrapper= Apnsnotifwrwrapper('Ck. pem', True)

Message= Apnsnotification()

Message.Token(Devicetoken)

Message.Alert("Very simple alert")

Message.Badge(5)

Message.Sound()

Wrapper.Append(Message)

Wrapper.Notify()


You can also use a third-party server:

Http://urbanairship.com/

 

 

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.