这就是我想要做的:
let eventStore = EKEventStore()eventStore.requestAccesstoEntityType(EKEntityType(),EKEventStoreRequestAccessCompletionHandler(Bool(),NSError(){}))
这是我得到的错误:
‘EKEventStoreRequestAccessCompletionHandler’不能用'(Bool,NSError)构造
你知道如何在Swift中正确使用方法或处理程序吗?
解决方法 请试试这个:func handler(granted: Bool,error: NSError!) { // put your handler code here}@IBAction func click(sender: AnyObject) { let eventStore = EKEventStore() // 'EKEntityTypeReminder' or 'EKEntityTypeEvent' eventStore.requestAccesstoEntityType(EKEntityTypeEvent,completion: handler) }
另一个变种是:
@IBAction func click(sender: AnyObject) { let eventStore = EKEventStore() // 'EKEntityTypeReminder' or 'EKEntityTypeEvent' eventStore.requestAccesstoEntityType(EKEntityTypeEvent,completion: { granted,error in // put your handler code here })}@H_404_2@ 总结
以上是内存溢出为你收集整理的如何在Swift iOS 8中使用requestAccessToEntityType方法全部内容,希望文章能够帮你解决如何在Swift iOS 8中使用requestAccessToEntityType方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)