2012-03-02 134 views
2

我開發與PhoneGap的iOS應用程序,需要爲它設置本地通知週五將重複在每個和指定時間註冊本地通知

也有要求,即用戶將決定接受或不在本地通知

回答

3

我建議你閱讀的話題下面的文章,我發現非常有用

http://useyourloaf.com/blog/2010/7/31/adding-local-notifications-with-ios-4.html

- (void)scheduleNotification { 

    [[UIApplication sharedApplication] cancelAllLocalNotifications]; 

     UILocalNotification *notif = [[UILocalNotification alloc] init]; 
     notif.fireDate = [datePicker date]; 
     notif.timeZone = [NSTimeZone defaultTimeZone]; 

     notif.alertBody = @"Body"; 
     notif.alertAction = @"AlertButtonCaption"; 
     notif.soundName = UILocalNotificationDefaultSoundName; 
     notif.applicationIconBadgeNumber = 1; 

     [[UIApplication sharedApplication] scheduleLocalNotification:notif]; 
     [notif release]; 
    } 
} 

這只是它是如何工作,但從此開始,你應該能夠安排通知的基本輪廓。

+1

我可以安排通知,但如何重複它的每個星期五,也發送本地通知 – user1244533 2012-03-02 10:18:55

+1

WTF甲肝你曾經自己做任何事情之前,如何激活用戶註冊? – 2016-01-17 11:01:38