2017-10-05 57 views
2

我在Xcode 9,iOS11上保存EKEvent時收到此NSInternalInconsistencyException錯誤。iOS不支持跨商店副本EKEvent

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

    } 

錯誤:

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

回答

3

每當你指定的任何值到其他對象意味着複製一個值到其他值,所以這是一段發送例外。

在我的情況:

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 
      } 

     } 

所以,它現在的工作。