[英]'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
I'm receiving a message in the log saying我在日志中收到一条消息说
'bundleNamePlaceholder'[8424:100146] [general] 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
'bundleNamePlaceholder'[8424:100146] [general] 'NSKeyedUnarchiveFromData' 不应用于取消归档,并将在未来版本中删除
The message is not clear to me but I'm assuming that it might be something related to a CoreData object or maybe its content我不清楚该消息,但我假设它可能与 CoreData object 或其内容有关
Is there a way to catch what's throwing this message or what might cause it?有没有办法捕捉抛出此消息的原因或可能导致此消息的原因?
apple is removing NSKeyedUnarchiveFromData
at some point because it's not secure by default.苹果有时会删除
NSKeyedUnarchiveFromData
,因为它默认不安全。 if you're storing a transformable value using NSKeyedUnarchiveFromData
in coredata, it will then become unreadable.如果您在 coredata 中使用
NSKeyedUnarchiveFromData
存储可转换的值,那么它将变得不可读。
https://www.kairadiagne.com/2020/01/13/nssecurecoding-and-transformable-properties-in-core-data.html https://www.kairadiagne.com/2020/01/13/nssecurecoding-and-transformable-properties-in-core-data.html
and https://developer.apple.com/forums/thread/107533和https://developer.apple.com/forums/thread/107533
To find out what is causing these log messages, try adding symbolic break points for要找出导致这些日志消息的原因,请尝试为
+[NSKeyedUnarchiver unarchiveObjectWithData:]
, +[NSKeyedUnarchiver unarchiveObjectWithData:]
,
+[NSKeyedUnarchiver unarchiveTopLevelObjectWithData:error:]
, and +[NSKeyedUnarchiver unarchiveTopLevelObjectWithData:error:]
和
+[NSKeyedUnarchiver unarchiveObjectWithFile:]
This helped me help finding the culprit.这帮助我找到了罪魁祸首。
In my case problem was in using Transformable
type in CoreData for saving array of strings.在我的情况下,问题是在 CoreData 中使用
Transformable
类型来保存字符串数组。 By default CoreData uses NSKeyedUnarchiver
instead of NSSecureUnarchiveFromData
transformer.默认情况下,CoreData 使用
NSKeyedUnarchiver
而不是NSSecureUnarchiveFromData
转换器。 So changing transformer solved this problem.所以更换变压器解决了这个问题。
Usually this is related to Core Data Transformable attributes however in my case this was also caused by an external library which was using NSValueTransformer.valueTransformerNames
to iterate over all value transformer classes available in runtime.通常这与核心数据可转换属性有关,但在我的情况下,这也是由外部库引起的,该库使用
NSValueTransformer.valueTransformerNames
迭代运行时可用的所有值转换器类。 This was also causing the same errors in logs and symbolic breakpoints given in other answer here did not catch them.这也导致了日志中的相同错误,并且此处其他答案中给出的符号断点没有捕获它们。 So if you cannot find a reason why you have this logs you might also want to search for
NSValueTransformer
in your code and check if there isn't a similar problem somewhere.因此,如果您找不到拥有此日志的原因,您可能还想在代码中搜索
NSValueTransformer
并检查某处是否没有类似的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.