Skip to main content

Legacy iOS Push Notifications

Deprecated — do not use for new games

Legacy iOS SDK is in maintenance-only mode and will be removed. New games must use SDK v2 Push.

The legacy iOS framework supports APNs registration and Firebase Messaging integration through OEGManager and FirebaseService.

Register for notifications

The framework can request notification authorization and register for remote notifications:

[OEGManager registerForRemoteNotifications:[UIApplication sharedApplication]];

In many integrations this already happens during:

[OEGManager handleDidFinishLaunchingWithOptions:launchOptions];

Forward APNs token

Your AppDelegate must pass the APNs device token back into the SDK:

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[OEGManager handleDidRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

Forward notification payloads

Forward incoming remote notification payloads to the framework:

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
[OEGManager handleRemoteNotification:userInfo];
}

Firebase Messaging access

If your app needs direct access to Firebase messaging helpers, the framework also exposes FirebaseService.

#import <OEGFramework/FirebaseService.h>

FirebaseService *service = [[FirebaseService alloc] init];
NSString *fcmToken = [service getFCMToken];
[service messagingDelegate:self];

Delegate methods:

- (void)messagingDidRefreshRegistrationToken:(NSString *)fcmToken {
NSLog(@"FCM token: %@", fcmToken);
}

- (void)messagingDidReceiveMessage:(NSDictionary *)remoteMessage {
NSLog(@"Push payload: %@", remoteMessage);
}

Notes

  • Add GoogleService-Info.plist if you use Firebase Messaging.
  • Use the OEGManager forwarding methods even if your app also listens to push events directly.
  • Keep your host app push entitlement and APNs capabilities enabled in Xcode.