Push notifications on iphone

Hi,

Has anyone implemented push notifications with cocos2d-x on iPhone?

Thanks

Jesus

I think you need a wrapper, again.

yes, but probably someone did it in the past… and it would be nice to share the code with others… just as I do…

I’ve added this code at the didFinishLaunchingWithOptions method in the AppController.mm

// Let the device know we want to receive push notifications
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:
(UIRemoteNotificationType)(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound)];

, but I never see the promt window asking permission to use push notifications, so this code never fires:

  • (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    {
    NSLog("My token is: %", deviceToken);
    }

ok, now it works, solution here:

Is there some code available somewhere for this ?

Hey, You can go through with ShepHertz Push Notification API, provides various API’s for Push Notification across multiple platform.
Here you can find Sample Application. You can build Android as well as iOS app to use Push Notification in your App.