通知错误:添加通知请求失败并出现错误

Mat*_*att 1 notifications ios nsmanagedobjectid

尝试创建本地通知失败,并显示以下错误:

Adding notification request failed with error: Error
Domain=NSCocoaErrorDomain Code=4097 "connection to service named
com.apple.usernotifications.usernotificationservice" UserInfo=
{NSDebugDescription=connection to service named 
com.apple.usernotifications.usernotificationservice}
Run Code Online (Sandbox Code Playgroud)

这意味着什么?

Mat*_*att 7

这是通过尝试从通过一个URL造成objectID.uriRepresentation()userInfo通知。

有必要改为存储objectID.uriRepresentation().absoluteString

处理通知后,objectID可以通过以下方式恢复:

persistentStoreCoordinator
    .managedObjectID(forURIRepresentation: URL(string: uri))
Run Code Online (Sandbox Code Playgroud)