2012-07-10 37 views
4

事件詳細信息應該存儲在哪裏?如何爲我不知道的特定事件發出警報。請幫助編寫代碼或爲此類示例提供鏈接。 提前感謝。如何爲特定日期製作活動?

+0

您可以使用本地通知在特定日期觸發特定事件的警報。或者如果您不知道確切的日期,您可以使用APNS並從您的服務器發送推送通知。 – 2012-07-10 04:49:45

回答

1

您可以在語法上爲將來的日期安排在iPhone的事件提醒。這是一個示例項目,它可以幫助您按照程序在iPhone中安排事件。檢查這個鏈接。 https://developer.apple.com/library/ios/#samplecode/SimpleEKDemo/Introduction/Intro.html

+0

這是非常有用的。但我想在日曆日期框中顯示該特定日期。它可以完成嗎? – Bhoomi 2012-07-10 05:07:59

+0

標記特定日期的事件。然後在設備中運行它,因爲模擬器不包含壓光機。然後在iPhone設備上查看您的日曆應用程序。 :) – 2012-07-10 05:10:22

+0

但我必須使日曆programticaly,然後添加事件。 – Bhoomi 2012-07-10 05:19:28

2

您可以使用本地通知,這裏有一些用於調度的示例代碼。

- (void)scheduleNotification { 

    UILocalNotification *notif = [[UILocalNotification alloc] init]; 

    //notification for 3 days 
    notif.fireDate = [NSDate dateWithTimeInterval:60.0f*60.0f*24.0f*3.0f sinceDate:[NSDate date]]; 
    notif.timeZone = [NSTimeZone defaultTimeZone]; 
    notif.alertBody = @"We've missed you!"; 
    notif.alertAction = @"PLAY"; 
    notif.soundName = UILocalNotificationDefaultSoundName; 
    notif.applicationIconBadgeNumber = 1; 
    [[UIApplication sharedApplication] scheduleLocalNotification:notif]; 

}