0
当我访问属性birthdayContactIdentifier从EKEvent我总是立刻得到BAD_ACCESS错误(甚至不能够零检查)birthdayContactIdentifier BAD_ACCESS
这是我使用来获取
import UIKit
import EventKit
class ViewController: UIViewController {
let eventStore : EKEventStore = EKEventStore()
override func viewDidLoad() {
super.viewDidLoad()
eventStore.requestAccessToEntityType(.Event) { (granted, error) in
if granted == true {
let startDate = NSDate()
let endDate = startDate.dateByAddingTimeInterval(7.0*86400.0)
let events = self.eventStore.eventsMatchingPredicate(self.eventStore.predicateForEventsWithStartDate(startDate, endDate: endDate, calendars: nil))
for event in events {
if event.calendar.type == .Birthday {
NSLog("\(event.title)")
NSLog("\(event.birthdayContactIdentifier)") // BAD_ACCESS
}
}
}
}
}
}
我也发现一个较早的,苹果没有给任何解决方案,不幸的是。我会尝试birthdayPersonID,尽管它可能不会与Contacts框架兼容。但我会尽力回报。 – Guus
刚刚尝试过与birthdayPersonID,不会给出任何错误,但标识符是不同的,所以它不会获取正确的联系人。 – Guus
如果birthdayContactIdentifier错误,您如何验证它不同? (想知道是否有线索) – Feldur