如何为Nslocal通知设置自定义重复间隔.....? [英] How To set Custom repeat interval For Nslocal Notification.....?

查看:287
本文介绍了如何为Nslocal通知设置自定义重复间隔.....?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i am New to iphone Development .I Am Trying To Use NslocalNotification In My Project I Need To Give Remeinder For Every 2Hours or For Every Two Days Or For Every Two Months Etc..Currently I am Using NslocalNotification Repeat Interval .But Its Working For Only Every Minute For Every Hour using 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;
        }

此处如果结果为2取决于IntervalType我需要通知
它不与我合作

here If result is 2 depend Up on IntervalType I Need Notification its Not Working With Me

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


推荐答案

@Srinivas:

@Srinivas:

如果你看一下我在这个答案中发布的链接,你会发现我已经尝试了所有可能的解决方案来尝试做你想要的。

If you look at the link I have posted in this answer, You will come to know that I have tried every possible solution here to try and do what you want currently.

我在我的应用程序中尝试了所有这些以实现它,但这不起作用。

I had tried all this to implement it in my app, but this doesn't work.

我害怕说这个,但这是不可能的。它只允许将单位 NSCalendarUnit对象设置为重复间隔。

I am afraid to say this but this is not possible. It only allows the unit NSCalendarUnit objects to be set as a repeat interval.

我投资了差不多2个月(我在2010年12月问过这个问题)并在2011年2月自己回答)尝试通过不同的文章和不同的论坛在互联网上提供所有可能的解决方案,但没有人提供帮助。

I invested almost 2 months (I asked the question in Dec 2010 and answered it myself in February 2011) to try and implement every possible solution available on internet through different articles and different forums but none did help.

查看我的链接和了望如果某些内容对您有用,请提供所有答案。

Check out my link and lookout for all the answers if something is useful to you.

如何将本地通知重复间隔设置为自定义时间间隔?

真的希望这对你有帮助。

Really Hope that this helps you.

这篇关于如何为Nslocal通知设置自定义重复间隔.....?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆