EKEventStore,我是否需要单独为iOS 6安装EventKit.Framework?

时间:2012-09-24 16:01:37

标签: iphone ios6 eventkit ekeventkit

我有一个通用的iOS应用程序,努力使其与iOS 6兼容。我使用Cordova / Phonegap框架,所以我的应用程序是HTML,CSS和JS。我正在使用CalenderPlugin for Cordova,可以在GitHub上使用,在iOS 6之前正常工作。

问题从这里开始: Apple补充说,从iOS 6开始,在对日历和提醒进行任何操作之前,我们需要授予用户许可。这是示例代码:

EKEventStore    *eventStore = [[EKEventStore alloc] init];

if( [self checkIsDeviceVersionHigherThanRequiredVersion:@"6.0"] ) {

[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {

if (granted){
//---- codes here when user allow your app to access theirs' calendar.

}else
{
//----- codes here when user NOT allow your app to access the calendar.

}

:
:
}];

}


//**********************************************************************************

//   Below is a block for checking is current ios version higher than required version.

//**********************************************************************************

- (BOOL)checkIsDeviceVersionHigherThanRequiredVersion:(NSString *)requiredVersion
{
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

if ([currSysVer compare:requiredVersion options:NSNumericSearch] != NSOrderedAscending)
{
return YES;
}

return NO;
}

我当然添加了EventKit.Framework和EventKitUI.Framework。现在的事情是, 为了开发iOS 6,我下载并安装了iOS6 SDK附带的xCode 4.5。

xCode没有找到此方法requestAccessToEntityType,常量EKEntityTypeEvent也不可用。

似乎我缺少适用于iOS 6的EventKit.Framework,但是怎么样?我有xCode 4.5附带SDK for iOS 6.有什么建议吗?

2 个答案:

答案 0 :(得分:2)

问题已解决,

我通过右键单击项目下的框架添加了EventKit.framework,并将文件添加到项目中。这些框架适用于iOS 5.要为iOS 6添加框架,首先我从框架文件夹中删除了这个框架,然后转到Targets>摘要>链接的框架和库。在那里我按了+并添加了出现在iOS 6文件夹下的EventKit.framework。 干杯:-)快乐的编码。

答案 1 :(得分:0)

请检查您的BaseSDK,因为我在使用iOS6 SDK的XCode4.5中使用它没有问题。我通过App Store升级我的XCode 4.5,而不是从开发站点升级。

相关问题