APNS Setup - GravitumLabs/gravitum-ios-sdk GitHub Wiki
Gravitum Admin Panel Setup
In order to enable the Gravitum servers to send push notifications to iOS devices, please follow the following steps:
Find your game in the Gravitum Admin panel under Projects > List. Select the apple icon next to your game.

Please configure APNS for your game on iTunes Connect and locate the .p12 or .pem file. Upload the file on the Gravitum admin panel and enter the associated password.

Push Notifications
Analytics Init method automatically registers with Apple Push Notification service(APNs), push notifications are turned on with method useNotifications:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
Analytics * analytics = [[Analytics getAnalytics] initWithParameters:AppToken
AppSecret:AppSecret
SenderId:SenderId];
/////////////////////////////////////////////////////////////////////////////////
// Optional
[analytics SetUserId: userID];
[analytics SetUserName: userName;
[analytics SetGender: (Gender*)userGender];
[analytics SetBirthday: userBirthDay
monthBorn: userBirthMonth
yearBorn: userBirthYear
];
// Optional end
/////////////////////////////////////////////////////////////////////////////////
// Turn ON push notifications
[analytics useAnalytics : YES]; //or [[Analytics getAnalytics] useNotifications : YES];
/////////////////////////////////////////////////////////////////////////////////
[analytics Init]; //Launch analytics;
return YES;
}
The next step will to be capture your deviceToken received from APNs and publish to Gravitum. Also for analytics - listen for remote notifications. To implement this two steps copy the code below and paste it to the AppDelegate.m script
-(void)application : (UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(nonnull NSData *)deviceToken{
// NSLog(@"Registered! With Data: %@", deviceToken);
[[Analytics getAnalytics] SetDevicePushTokenData:deviceToken];
}
-(void)application : (UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo{
//Recieved notification
if(application.applicationState == UIApplicationStateInactive || application.applicationState == UIApplicationStateBackground){
//Notification was clicked from background or inactive state
[[Analytics getAnalytics] OpenedFromPush:userInfo];
}
}
Result should be like the screenshot:

Check if BundleIdentifier is valid (with provisioning profile)

Check code singning identity to automatic (developer or distribution)

Turn On Push Notifications in Capabilities
