简体   繁体   English

BirthdayContactIdentifier BAD_ACCESS

[英]birthdayContactIdentifier BAD_ACCESS

When I access the property birthdayContactIdentifier from EKEvent I always instantly get a BAD_ACCESS error (not even able to nil check) 当我从EKEvent访问属性BirthdayContactIdentifier时,我总是立即收到BAD_ACCESS错误(甚至无法无效检查)

This is the code I am using to fetch 这是我用来获取的代码

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  
                }  
            }  
        }  
     }   
  }  
} 

I found bug number 22475180 here . 我在这里找到错误号22475180。 Try birthdayPersonID. 尝试BirthdayPersonID。 It is currently deprecated as of iOS 9, but it might work differently 目前从iOS 9开始不推荐使用,但可能会有所不同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM