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,.carPla
y]) { (@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 set
Tings = UIUserNotificationSet
Tings(types: [.alert,
.sound],categories: nil)
@H_
801_18@ UIApplication.shared.registerUserNotificationSet
Tings(set
Tings)
@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,请注明来意。