gpt4 book ai didi

ios - 推送通知 - UIUserNotificationType 错误

转载 作者:行者123 更新时间:2023-11-29 12:31:40 25 4
gpt4 key购买 nike

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
...
}

是否可以让它在带有 iOS 7 的 xcode 5.1 中工作?

最佳答案

    if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")){
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
}

关于ios - 推送通知 - UIUserNotificationType 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27504299/

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