gpt4 book ai didi

ios - RemoteNotification 来自 launchOptions

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:00:24 26 4
gpt4 key购买 nike

在我的应用程序中,我添加了推送通知服务,一切正常。需要在 App 未处于事件或后台模式时处理通知。

我为此添加了如下代码。在方法中

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound];
NSDictionary *RemoteNoti =[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (RemoteNoti) {
//your methods to process notification
}
return YES;
}

例如,我收到了三个通知当应用程序未在后台或前台运行并且我点击通知时,它只会给我点击通知的详细信息。

它只提供点击通知的详细信息是正确的行为吗?或者应该有所有三个通知的详细信息 NSDictionary *RemoteNoti =[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

如果我遗漏了什么,请提出建议。

最佳答案

是的,这是正确的行为。您只会收到一个您选择的通知。

In dictionary containing the payload of the remote notification. > - alert: Either a string for the alert message or a dictionary with two keys: body and show-view. > - badge: A number indicating the quantity of data items to download from the provider. This number is to be displayed on the app icon. The absence of a badge property indicates that any number currently badging the icon should be removed. > - sound: The name of a sound file in the app bundle to play as an alert sound. If “default” is specified, the default sound should be played.

关于ios - RemoteNotification 来自 launchOptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24967952/

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