在 React Native 的前台设置 PushNotificationIOS 时发出警告
Warning while setting up PushNotificationIOS on foreground in React Native
我在 Xcode 上收到以下警告,而 setting up foreground push notification on IOS:
Assigning to 'id<UNUserNotificationCenterDelegate> _Nullable'
from incompatible type 'AppDelegate *const __strong'
此警告出现在该代码段的最后一行:
// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
我的应用程序按预期编译和运行。我没有使用 objective-c 的经验,所以我不知道这是怎么回事。我该如何解决?
我有同样的问题并通过将 UNUserNotificationCenterDelegate
添加到我的 AppDelegate 接口解决了它:
@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>
我在 Xcode 上收到以下警告,而 setting up foreground push notification on IOS:
Assigning to 'id<UNUserNotificationCenterDelegate> _Nullable'
from incompatible type 'AppDelegate *const __strong'
此警告出现在该代码段的最后一行:
// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
我的应用程序按预期编译和运行。我没有使用 objective-c 的经验,所以我不知道这是怎么回事。我该如何解决?
我有同样的问题并通过将 UNUserNotificationCenterDelegate
添加到我的 AppDelegate 接口解决了它:
@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>