gpt4 book ai didi

ios11 - iOS 还不支持跨商店复制 EKEvent

转载 作者:行者123 更新时间:2023-12-04 03:03:44 32 4
gpt4 key购买 nike

我在 Xcode 9、iOS11 上保存 EKEvent 时遇到此 NSInternalInconsistencyException 错误。

do {
try eventStore.saveEvent(newEvent, span: .ThisEvent, commit: true)
} catch {

}

错误:

Fatal Exception: NSInternalInconsistencyException iOS doesn't support cross-store copies yet.

最佳答案

每当您将任何值分配给其他对象时,都意味着将一个值复制到另一个值,因此有时会发送异常。

以我为例:

if(orginalEvent.structuredLocation != nil){
newEvent.structuredLocation = orginalEvent.structuredLocation
}

因此,我已将其替换为以下内容:

if(orginalEvent.structuredLocation != nil){
if orginalEvent.structuredLocation!.title.characters.count > 0{

let location = EKStructuredLocation(title: orginalEvent.structuredLocation!.title)
if(orginalEvent.structuredLocation?.geoLocation != nil){
location.geoLocation = CLLocation(latitude: (orginalEvent.structuredLocation?.geoLocation?.coordinate.latitude)!, longitude: (orginalEvent.structuredLocation?.geoLocation?.coordinate.longitude)!)
}

newEvent.structuredLocation = location
}

}

所以,它现在可以正常工作了。

关于ios11 - iOS 还不支持跨商店复制 EKEvent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46588473/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com