尝试创建本地通知失败并出现以下错误:
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}
这是什么意思?
最佳答案
这是由于试图在通知的 userInfo
中传递来自 objectID.uriRepresentation()
的 URL。
有必要存储 objectID.uriRepresentation().absoluteString
来代替。
处理通知后,可以通过以下方式恢复objectID
:
persistentStoreCoordinator
.managedObjectID(forURIRepresentation: URL(string: uri))
关于ios - 通知错误 : Adding notification request failed with error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57649934/