[英]birthdayContactIdentifier BAD_ACCESS
當我從EKEvent訪問屬性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
}
}
}
}
}
}
我在這里找到錯誤號22475180。 嘗試BirthdayPersonID。 目前從iOS 9開始不推薦使用,但可能會有所不同
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.