相关疑难解决方法(0)

自定义报警的UILocalNotification重复间隔(太阳,周一,周二,周三,星期四,星期五,坐着)

UILocalNotification用于报警目的.我有一个基于工作日重复的自定义选项(sun,mon,tue,wed,thu,fri,sat).许多应用程序都执行了此过程.我最好的尝试了我的水平.但我无法让它发挥作用.请各位帮帮我....

iphone nscalendar ipad ios uilocalnotification

12
推荐指数
1
解决办法
2万
查看次数

iPhone:每日本地通知

我正在尝试实施本地通知

这就是我设定的

    // Current date
    NSDate *date = [NSDate date]; 

    // Add one minute to the current time
    NSDate *dateToFire = [date dateByAddingTimeInterval:20];

    // Set the fire date/time
    [localNotification setFireDate:dateToFire];
    [localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
Run Code Online (Sandbox Code Playgroud)

而不是20,我想把一个固定的时间(每天)开始推动.

例如:我想每隔早上6点按下弹出通知.

怎么办?

谢谢

iphone notifications objective-c ios uilocalnotification

9
推荐指数
1
解决办法
2万
查看次数

UILocalNotification的自定义重复间隔

我尝试了Re.minder应用程序并注意到它可以使用自定义间隔(例如每3分钟,每2小时,每4天......)重复提醒.

我怎样才能做到这一点?

ios uilocalnotification

7
推荐指数
1
解决办法
8731
查看次数

如何为Nslocal通知设置自定义重复间隔.....?

我是iphone开发的新手.我正在尝试在我的项目中使用NslocalNotification我需要每2小时或每两天或每两个月给予记忆等等.目前我正在使用NslocalNotification重复间隔.但它仅用于工作每小时使用Nscalender的每分钟....

        NSString *InterVal=[freQuencyArr objectAtIndex:index-2];
        NSString *InterValType=[freQuencyArr objectAtIndex:index-1];
        if(![InterVal isEqualToString:@"Every"])
        {  
         result=[InterVal intValue];
        }else
          result=1;
        if([InterValType isEqualToString:@"Day"]){
             notification.repeatInterval= NSDayCalendarUnit;    
        }else if([InterValType isEqualToString:@"Week"]){
            notification.repeatInterval= NSWeekCalendarUnit;    
         }
        else if([InterValType isEqualToString:@"Month"]){
            notification.repeatInterval= NSMonthCalendarUnit;   
        }else if([InterValType isEqualToString:@"days"]){
             notification.repeatInterval=result*24*60*60;
        }
Run Code Online (Sandbox Code Playgroud)

这里如果结果是2取决于IntervalType我需要通知它不能和我一起工作

         if([InterValType isEqualToString:@"days"]){
             notification.repeatInterval=result*24*60*60;
        }
Run Code Online (Sandbox Code Playgroud)

iphone objective-c nsnotifications nsnotificationcenter

6
推荐指数
1
解决办法
5328
查看次数

Swift 每 5 天重复一次 LocalNotification

如何在上午 10:00 每 5 天重复一次 LocalNotification

我试试这个,但它不起作用

let content = UNMutableNotificationContent()
content.title = "Hello!"
content.body = "Hello_message_body"
content.sound = UNNotificationSound.default()

let futureTime = Date().addingTimeInterval(5 * 24 * 60 * 60)
var calendar = NSCalendar.current
calendar.timeZone = NSTimeZone.system
var components = calendar.dateComponents([.hour, .minute, .second], from: futureTime)
components.hour = 10
components.minute = 0
components.second = 0

let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true)
let request = UNNotificationRequest(identifier: "FiveDays", content: content, trigger: trigger)
let center = UNUserNotificationCenter.current()
center.add(request)
Run Code Online (Sandbox Code Playgroud)

ios localnotification swift unusernotificationcenter

3
推荐指数
1
解决办法
2122
查看次数