I am new to this topic and require some guidance in implementing Apple Push Notification in my application. I have created my appID and also configured Apple Push Notification for the same. I have downloaded the provisioning profile and installed the app on the iphone. I have also written the following code provided by Apple documentation
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
const void *devTokenBytes = [devToken bytes];
NSLog(@"devToken=%@",devTokenBytes);
//self.registered = YES;
//[self sendProviderDeviceToken:devTokenBytes]; // custom method
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
{
NSLog(@"Error in registration. Error: %@", err);
}
I want to know what I have to write on the server side. When I run the code it says that the device is not registered. How can I register my application for the push notification.
Can anyone help me with this...
Any code will be very helpful...
Thanx in advance...
Setting up Push Notifications in iOS. Go back to the iOS project you created earlier and select the main target. Under the Signing & Capabilities tab, click on the + Capability button, then select Push Notifications. This will enable your app to receive push notifications from OneSignal.
Remote Notifications Communicate with Apple Push Notification service (APNs) and receive a unique device token that identifies your app. Use basic macOS command-line tools to send push notifications to Apple Push Notification service (APNs).
Here are four types of push notifications, including mobile, to test in your next campaign. 1. Mobile app push notifications: generated via an app downloaded on a user's mobile device. Displayed in three locations: lock screen, banner and notification center.
You need to tell your server about the device token returned by Apple when you register for notifications from the device, so that the server can present the same token and app id when it tells the apple server that there's a new notification. Have you done that? I believe the device token could change each time you register, so you'll need to keep track of that on your server (and tell the server each time).
You've shown the callbacks involved in device registration, but have you actually called the registration method itself?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With