IOS实用功能-系统本地通知的创建

////  ViewController.swift//  Dome2test////  Created by 郭文亮 on 2018/11/22.//  Copyright © 2018年 finalliang. All rights reserved.//import UIKit//用户通知类库import UserNotifications//对于函数 类和协议。可以...
摘要由CSDN通过智能技术生成
//
//  ViewController.swift
//  Dome2test
//
//  Created by 郭文亮 on 2018/11/22.
//  Copyright © 2018年 finalliang. All rights reserved.
//

import UIKit
//用户通知类库
import UserNotifications
//对于函数 类和协议。可以使用@available声明这些类型的生命周期,依赖于特定的平台货或者操作系统版本
@available(iOS 10.0,*)
//使用当前的的视图控制器类 尊魂用户通知中心协议。 用于处理接受的通知 以及通知相关错左操作
class ViewController: UIViewController ,UNUserNotificationCenterDelegate{
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        //创建一个本地通知对象
        let localNotification = UILocalNotification()
        //创建一个基于当前时间的日期对象
        let  now = Date()
        //设置在当前时间的五秒后 触发本地通知
        localNotification.fireDate = now.addingTimeInterval(5)
        //然后设置本地通知的重复次数
        localNotification.repeatInterval = NSCalendar.Unit.init(rawValue: 0)
        //设置本地通知的时区为默认时区
        localNotification.timeZone = .current
        //设置本地通知的提醒声音模版
        localNotification.soundName = UILo
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值