Swift   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Swift用户通知授权大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {         if #available(iOS 10.0, *) {             UNUser
@H_801_18@    func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

@H_801_18@        if #available(iOS 10.0,*) {

@H_801_18@            UNUserNotificationCenter.current().requestAuthorization(options: [.sound,.badge,.alert,.carPlay]) { (@R_696_6048@s,_) in

@H_801_18@                if @R_696_6048@s {

@H_801_18@                    print("授权成功")

@H_801_18@                } else {

@H_801_18@                    print("授权失败")

@H_801_18@                }

@H_801_18@            }

@H_801_18@        } else {

@H_801_18@            let setTings = UIUserNotificationSetTings(types: [.alert,.sound],categories: nil)

@H_801_18@            UIApplication.shared.registerUserNotificationSetTings(setTings)

@H_801_18@        }

@H_801_18@        

@H_801_18@        // Override point for customization after application launch.

@H_801_18@        return true

@H_801_18@    }

@H_801_18@注意需要

@H_801_18@import UserNotifications

大佬总结

以上是大佬教程为你收集整理的Swift用户通知授权全部内容,希望文章能够帮你解决Swift用户通知授权所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。