diff --git a/Assets/Plugins/iOS/AppboyAppDelegate.mm b/Assets/Plugins/iOS/AppboyAppDelegate.mm index 4f4bded7a..d8a227769 100644 --- a/Assets/Plugins/iOS/AppboyAppDelegate.mm +++ b/Assets/Plugins/iOS/AppboyAppDelegate.mm @@ -33,14 +33,18 @@ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(N } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { - [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; + if ([UnityAppController instancesRespondToSelector:@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:)]) { + [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; + } NSLog(@"AppboyAppDelegate called from application:didRegisterForRemoteNotificationsWithDeviceToken with token %@", deviceToken); // Register push token with Appboy [[AppboyUnityManager sharedInstance] registerPushToken:deviceToken]; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { - [super application:application didReceiveRemoteNotification:userInfo]; + if ([UnityAppController instancesRespondToSelector:@selector(application:didReceiveRemoteNotification:)]) { + [super application:application didReceiveRemoteNotification:userInfo]; + } NSLog(@"AppboyAppDelegate called from application:didReceiveRemoteNotification:. UIApplicationState is %ld", (long)[[UIApplication sharedApplication] applicationState]); // Pass notification to Appboy @@ -49,7 +53,9 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(N } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler { - [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:handler]; + if ([UnityAppController instancesRespondToSelector:@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:)]) { + [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:handler]; + } NSLog(@"AppboyAppDelegate called from application:didReceiveRemoteNotification:fetchCompletionHandler:. UIApplicationState is %ld", (long)[[UIApplication sharedApplication] applicationState]); // Pass notification to Appboy diff --git a/CHANGELOG.md b/CHANGELOG.md index c89dc2ce7..81e12e9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.8.2 +* Updates the SDK to be compatible with unity 5.4+. In 5.4.0 Unity stopped implementing push delegates in UnityAppController in certain conditions, causing a crash when the Appboy SDK tried to call them. + ## 1.8.1 * Updates SDK to modify delegate usage to fix an issue with push-click handling introduced in iOS 10 - see https://github.com/Appboy/appboy-ios-sdk/blob/master/CHANGELOG.md for details.