Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning while setting up PushNotificationIOS on foreground in React Native

I am getting the following warning on Xcode while setting up foreground push notification on IOS:

Assigning to 'id<UNUserNotificationCenterDelegate> _Nullable' 
from incompatible type 'AppDelegate *const __strong'

this warning appears on the last line of this snippet:

// Define UNUserNotificationCenter
  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
  center.delegate = self;

My app compiles and runs as expected. I have no experience with objective-c, so I have no idea what this is about. How can I solve it?

like image 879
Vinicius Avatar asked Aug 31 '26 07:08

Vinicius


1 Answers

I had the same issue and solved it by adding UNUserNotificationCenterDelegate to my AppDelegate interfaces:

@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>
like image 89
Mika Andrianarijaona Avatar answered Sep 02 '26 20:09

Mika Andrianarijaona



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!