iphone - 将数据添加到日历不起作用
<p><p>我正在尝试使用以下代码在日历中添加 session 详细信息。但是它不起作用。我总是得到错误代码(其他部分正在执行)。</p>
<pre><code>EKEventStore *eventSotre = [ init];
EKEvent *event = ;
event.title= @"Event Title";
NSDate *duedate = [ init];
event.startDate = duedate;
// also tried with below
// event.startDate = [ initWithTimeInterval:200 sinceDate:duedate];
event.endDate= [ initWithTimeInterval:600 sinceDate:duedate];
NSArray *arrAlarm = ];
event.alarms= arrAlarm;
];
NSError *err;
BOOL isSuceess=;
if(isSuceess){
UIAlertView *alertview = [ initWithTitle:@"Event" message:@"Event added in calendar" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
;
;
}
else{
UIAlertView *alertview = [ initWithTitle:@"Error" message: delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
;
;
}
;
</code></pre>
<p>知道我为什么要面对这个吗?我的代码中也有 <code>#import <EventKit/EventKit.h></code> 并且我也添加了相同的框架。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>下面的链接解决了我的问题。</p>
<p> <a href="https://stackoverflow.com/a/13451544/1066828" rel="noreferrer noopener nofollow">https://stackoverflow.com/a/13451544/1066828</a> </p>
<p>问题是我有 iOS 6。</p></p>
<p style="font-size: 20px;">关于iphone - 将数据添加到日历不起作用,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/16012819/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/16012819/
</a>
</p>
页:
[1]