iOS 設置每天下午4點推送本地通知

bx52 9年前發布 | 7K 次閱讀 Objective-C IOS

UILocalNotification *notification=[[UILocalNotification alloc] init];
    if (notification!=nil) {//判斷系統是否支持本地通知
        notification.fireDate = [NSDate dateWithTimeIntervalSince1970:16*60*60*24];//本次開啟立即執行的周期
        notification.repeatInterval=kCFCalendarUnitWeekday;//循環通知的周期
        notification.timeZone=[NSTimeZone defaultTimeZone];
        notification.alertBody=@"哇哇哇";//彈出的提示信息
        notification.applicationIconBadgeNumber=0; //應用程序的右上角小數字
        notification.soundName= UILocalNotificationDefaultSoundName;//本地化通知的聲音
//notification.alertAction = NSLocalizedString(@"美女呀", nil);  //彈出的提示框按鈕
        notification.hasAction = NO;
        [[UIApplication sharedApplication]   scheduleLocalNotification:notification];
    }

 本文由用戶 bx52 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!