问题描述
我有一个应用程序可在AR中提供协作,并且我一直在关注如何使用ARSession.CollaborationData
发送MultipeerConnectivity
的文档。
看来,在iOS 14中,这不再可能。尝试取消存档时收到以下错误:
'ARCollaborationData'类不允许安全编码。它必须返回 来自supportSecureCoding,是。
我或多或少地使用了文档中给出的确切代码,并且它在iOS 13上可以完美运行。现在,在iOS 14上,我不确定如何解决此问题。我尝试使用requiringSecureCoding: false
发送它,并尝试创建一个NSKeyedUnarchiver
也设置为false的requiresSecureCoding
。据我所知,我无法为NSSecureCoding
更改ARSession.CollaborationData
的实现(据说应该仍然存在)。
这是发送数据的代码:
guard let encodedData = try? NSKeyedArchiver.archivedData(
withRootObject: data,requiringSecureCoding: true
)
else { fatalError("Unexpectedly Failed to encode collaboration data.") }
// Use reliable mode if the data is critical,and unreliable mode if the data is optional.
let dataIsCritical = data.priority == .critical
try session.send(
encodedData,toPeers: session.connectedPeers,with: dataIsCritical ? .reliable : .unreliable
)
NSKeyedUnarchiver.unarchivedobject(ofClass: ARSession.CollaborationData.self,from: data)
其他人以前有这个问题吗?难道这是一个错误,我只需要报告它并等待?无论哪种方式,在此先感谢您的提示或技巧:)非常感谢!
最好的问候, 比约恩
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)