啊 ,但是感觉没有必要推送到服务器。只弄个本地的就好了。话说其实我也不是很懂服务器的知识,刚刚开始学习ios开发。

解决方案 »

  1.   


    啊 ,但是感觉没有必要推送到服务器。只弄个本地的就好了。话说其实我也不是很懂服务器的知识,刚刚开始学习ios开发。用NSDate的函数来获取 或者用一些开源的第三方框架.....但是建议你如果是新手还是自己去实现这块 对你熟悉ios是有帮助的 因为ios本身没有后台待的功能....所以最好是服务器推送....
      

  2.   


    啊 ,但是感觉没有必要推送到服务器。只弄个本地的就好了。话说其实我也不是很懂服务器的知识,刚刚开始学习ios开发。用NSDate的函数来获取 或者用一些开源的第三方框架.....但是建议你如果是新手还是自己去实现这块 对你熟悉ios是有帮助的 因为ios本身没有后台待的功能....所以最好是服务器推送....
    嗯,用uilocalnotification不可以吗?
      

  3.   

    貌似真的可以 刚才查了一下 确实是.....嘻嘻 
    主要代码:
           NSDate* now = [NSDate date];
        NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
        NSDateComponents *comps = [[NSDateComponents alloc] init];
        NSInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit |
        NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
        comps = [calendar components:unitFlags fromDate:now];
        int hour = [comps hour];
        int min = [comps minute];
        int sec = [comps second]; 
    //--------------------------------------------取得系统的时间,并将其一个个赋值给变量---------------------代码二:UILocalNotification *notification=[[UILocalNotification alloc] init];
        if (notification!=nil) 
        {        NSDate *now=[NSDate new];
            notification.fireDate=[now addTimeInterval:hm]; //设置响应时间,单位 秒
            NSLog(@"%d",hm);
            notification.timeZone=[NSTimeZone defaultTimeZone]; 
            notification.soundName = @"ping.caf";          //加入声音
            //notification.alertBody=@"TIME!";
            
            notification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"你设置的时间是:%i : %i .",nil),htime1,mtime1];  //弹出对话框         [[UIApplication sharedApplication]   scheduleLocalNotification:notification];
            
            
        }