【发布时间】:2023-12-29 02:37:01
【问题描述】:
我正在尝试设置提醒,需要在 Swift 2.0 for iOS9 中访问实体类型方法的请求。但是,它给了我错误:
使用未解析的标识符
@IBAction func setReminder(sender: AnyObject) {
appDelegate = UIApplication.sharedApplication().delegate
as? AppDelegate
if appDelegate!.eventStore == nil {
appDelegate!.eventStore = EKEventStore()
appDelegate!.eventStore!.requestAccessToEntityType(EKEntityTypeReminder, completion: {(granted, error) in //use of unresolved identifier EKEntityTypeReminder
if !granted {
println("Access to store not granted")
println(error.localizedDescription)
} else {
println("Access granted")
}
})
}
if (appDelegate!.eventStore != nil) {
self.createReminder()
}
}
此代码适用于 Swift,但不适用于 Swift 2。有人遇到过此类问题吗?
【问题讨论】:
标签: ios swift swift2 ios9 eventkit