Kal 在同一事件中显示 2 个单元格
我创建了一个 iPhone 应用程序,它在选项卡栏环境中使用 Kal 框架。
我使用 EVENTKIT 框架创建一个新事件,它向用户显示如下:
单击完成后.. 事件保存..
但是 当我查看时Kal 日历显示同一事件的 2 个条目:
如果 我关闭应用程序,然后再次打开它,它会正确显示一个单元格中的事件条目..
但我不明白为什么它在添加后立即显示同一事件两次..
任何人都可以帮忙吗?
编辑: 当我单击“今天”按钮时,它似乎重置/刷新数据并且工作正常。 我目前正在尝试弄清楚如何在每次添加事件时刷新/重置它。
任何帮助将不胜感激:)
I have created an iphone application which utilises the Kal framework within a tab bar environment.
I create a new event using the EVENTKIT framework and it shows up to the user like this:
after you click done.. the event saves..
BUT when I view the Kal calendar it shows 2 entries for the same event:
IF I close the application, then open it again, it correctly shows the event entry in one cell..
but I don't understand why it shows the same event twice immediately after I add it..
Can anyone help?
Edit:
When I click the "Today" button it seems to reset/refresh the data and it works correctly..
I am currently trying to figure out how I could get it to refresh/reset every time an event is added..
Any help will be appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的代码基于 NativeCal 示例,则存在错误
,因为
[events removeAllObjects]
在函数顶部调用,然后在dispatch_async
块,如果在第一次调用完成之前再次调用该函数,则事件列表可能包含重复事件。我通过将dispatch_async
调用更改为dispatch_sync
来修复此问题,以阻止对主线程的回调并清除该调用中的事件列表,生成以下代码:If your code is based on the NativeCal example, there is a bug in
because
[events removeAllObjects]
is called at the top of the function, and then is repopulated later in thedispatch_async
block, the events list can contain duplicate events if the function is called again before the first call completes. I fixed this by changing thedispatch_async
call todispatch_sync
to block on the call back to the main thread and to clear the events list in that call, producing the following code:我对您将事件添加到 Kal 日历的解决方案感到困惑。我正在阅读头文件和实现文件 KalDataSource.h 和 KalDataSource.m,似乎创建事件的所有代码都应该发生在那里。无论如何,你能告诉我你在将事件添加到你的 kal 日历中做了什么吗?
I am puzzled on your solution to adding events into the Kal calendar. I was reading the header file and implementation file KalDataSource.h and KalDataSource.m and it seems that all the code to create an event should occur there. Is their anyway you could tell me what you did in adding events into your kal calendar?