gpt4 book ai didi

ios - defaultCalendarForNewEvents 失败

转载 作者:IT王子 更新时间:2023-10-29 07:46:17 25 4
gpt4 key购买 nike

当我尝试调用 [newEventStore defaultCalendarForNewEvents] 时,它返回一条错误消息:

[707:907] defaultCalendarForNewEvents failed: Error Domain=EKCADErrorDomain Code=1013 "The operation couldn’t be completed. (EKCADErrorDomain error 1013.)"
[707:907] Error!Failed to save appointment. Description:Error Domain=EKErrorDomain Code=1 "No calendar has been set." UserInfo=0x1fc679f0 {NSLocalizedDescription=No calendar has been set.}

该应用程序运行了很长时间。这个问题第一次来找我。手机运行IOS6 Beta4。型号是iphone 4。有谁知道 defaultCalendarForNewEvents 方法何时会失败?我无法通过谷歌搜索获得任何有用的信息。

最佳答案

在 iOS6 上,Apple 引入了一个新的隐私控件,允许用户控制每个应用程序的联系人和日历的可访问性。因此,在代码方面,您需要添加一些方法来请求权限。在 iOS5 或之前,我们总是可以调用

EKEventStore *eventStore = [[[EKEventStore alloc] init] autorelease];
if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
// iOS 6 and later
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
if (granted) {
// code here for when the user allows your app to access the calendar
[self performCalendarActivity:eventStore];
} else {
// code here for when the user does NOT allow your app to access the calendar
}
}];
} else {
// code here for iOS < 6.0
[self performCalendarActivity:eventStore];
}

关于ios - defaultCalendarForNewEvents 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12454324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com