Assigning to 'id<UNUserNotificationCenterDelegate> _Nullable' from incompatible type 'AppDelegate *const __strong'
I have configured this library as described in documentation and I see this Warning Assigning to 'id<UNUserNotificationCenterDelegate> _Nullable' from incompatible type 'AppDelegate *const __strong'
after adding Inside didFinishLaunchingWithOptions
// Define UNUserNotificationCenter UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self;
on iOS Deployment Target 10.0+ I have even more Warnings:
'UIUserNotificationSettings' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationSettings 'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest
As per Apples's documentation UNUserNotificationCenter is only available from iOS 10+. You'll need to check iOS version in conditional. Additionally this block is only needed if you want to handle notifications when app is in the foreground.
@dominiczaq actually you will see this warning no matter the target is. I think that the documentation and also the library itself need some updates because some statements are either not supported or deprecated..
I believe there is no warning when I've changed the target to iOS 10+.
Documentation should probably mention that this part is only needed for foreground notification handling and it only supports iOS 10+ (the rest of lib works fine in iOS 9)
@dominiczaq the warning is still there
Any updates regarding this warning?
Added this to my AppDelegate.h and the warning went away:
#import <UserNotifications/UNUserNotificationCenter.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
Added this to my
AppDelegate.hand the warning went away:#import <UserNotifications/UNUserNotificationCenter.h> @interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
This one is works for me Thank you
i am getting this error with react native version 0.71.13 and my AppDelegate.h file is using RCTAppDelegate. I am trying to upgrade from 0.70.5 so can't use
// @interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>
in my AppDelegate.h file
@Abfareye See this instructions: https://github.com/react-native-push-notification/ios/pull/392/files
Added this to my
AppDelegate.hand the warning went away:#import <UserNotifications/UNUserNotificationCenter.h> @interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
this worked thanks : #import <UserNotifications/UNUserNotificationCenter.h> @interface AppDelegate : RCTAppDelegate <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>