gpt4 book ai didi

ios - 在 React Native 前台设置 PushNotificationIOS 时发出警告

转载 作者:行者123 更新时间:2023-11-29 05:27:30 33 4
gpt4 key购买 nike

setting up foreground push notification on IOS 时,我在 Xcode 上收到以下警告:

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)来解决它:

@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>

关于ios - 在 React Native 前台设置 PushNotificationIOS 时发出警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58022324/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com