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/