i am new in iphone development,i want to implement push Notification in my application. i have no idea about that. anyone give sample code.
Asked
Active
Viewed 1.3k times
0
-
Perhaps a google search would answer this better? for example the first hit I got was: http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/ – GWW Dec 17 '10 at 06:46
-
First read all the other questions and answers on this topic here on SO. The simplest way to get started is using Urban Airship, but that doesn't mean it's necessarily the best fit for you. http://stackoverflow.com/search?q=Urban+Airship – Felixyz Dec 17 '10 at 11:42
-
1possible duplicate of [Apple PNS (push notification services) sample code](http://stackoverflow.com/questions/1052645/apple-pns-push-notification-services-sample-code) – Felixyz Dec 17 '10 at 11:44
-
Read this question http://stackoverflow.com/q/14563097/1868660 Sending multiple iphone push notifications + APNS + PHP + Tutorial – Subodh Ghulaxe Dec 20 '13 at 16:32
-
Could you please provide me steps that how can i send content-available in aps section? – Naresh Jan 16 '15 at 12:23
2 Answers
10
Firstly, you have to either rent or own a server that is responsible for communicating with Apple's APNS servers. Yes, when pushing notifications to your app's users, your server has to first push it to Apple and have Apple transfer those notifications to specific users on your behalf.
And second, override and implement the following methods in your AppDelegate's .m file:
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
//You probably already implemented this one
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
And test your code and your server with Apple's Sandbox server before you put your app into production.

Di Wu
- 6,436
- 3
- 35
- 51