iOS 15 warning: NSKeyedUnarchiver _warnAboutPlistType:missingInAllowedClasses:

I compiled my app with Xcode 13 beta and am getting a bunch of runtime warnings like this. I've also noticed someone else on Twitter experiencing the same thing.

Any idea what's causing this? Something with my plist file formatting?

I don't use Core Data (used to long ago but don't think I have any relics of that in my project anywhere) which was my first thought when seeing NSKeyedUnarchiver.

2021-06-17 00:54:02.295892+0300 RedactedAppName[3659:1216650] [general] *** -[NSKeyedUnarchiver _warnAboutPlistType:missingInAllowedClasses:] allowed unarchiving safe plist type ''NSString' (0x1ef8aebe0) [/System/Library/Frameworks/Foundation.framework]', even though it was not explicitly included in the client allowed classes set: '{(
  "'NSDate' (0x1ef8a3e30) [/System/Library/Frameworks/CoreFoundation.framework]",
  "'NSDictionary' (0x1ef8a3f98) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.

2021-06-17 00:54:02.296016+0300 RedactedAppName[3659:1216650] [general] *** -[NSKeyedUnarchiver _warnAboutPlistType:missingInAllowedClasses:] allowed unarchiving safe plist type ''NSString' (0x1ef8aebe0) [/System/Library/Frameworks/Foundation.framework]', even though it was not explicitly included in the client allowed classes set: '{(
  "'NSDate' (0x1ef8a3e30) [/System/Library/Frameworks/CoreFoundation.framework]",
  "'NSDictionary' (0x1ef8a3f98) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.

2021-06-17 00:54:02.448722+0300 RedactedAppName[3659:1216462] [general] *** -[NSKeyedUnarchiver _warnAboutPlistType:missingInAllowedClasses:] allowed unarchiving safe plist type ''NSString' (0x1ef8aebe0) [/System/Library/Frameworks/Foundation.framework]', even though it was not explicitly included in the client allowed classes set: '{(
  "'NSDate' (0x1ef8a3e30) [/System/Library/Frameworks/CoreFoundation.framework]",
  "'NSDictionary' (0x1ef8a3f98) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.

Replies

I'm also facing this issue; although, I am using CoreData.

Looks like it's coming from the Firebase(GoogleUtilities) library for line -

[NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:data error:outError]

Thanks, that must be it I use Firebase. It looks like they have fixed it.. hope to see it released soon.

  • I'm still having the problem, where do you see it fixed?

  • Same here. Is there a fix for this? I just upgraded to Xcode 13

  • Was only doing:             guard let myarray = try? NSKeyedUnarchiver.unarchivedObject(ofClasses:[NSArray.self], from: mydata) as? NSArray Array of numbers, adding this solved it for me:             guard let myarray = try? NSKeyedUnarchiver.unarchivedObject(ofClasses:[NSArray.self,NSNumber.self], from: mydata) as? NSArray

Add a Comment

I'm not using firebase. I'm using a custom DataTransformer.

Specifying the type here fixed it:     override static var allowedTopLevelClasses: [AnyClass] {

        return [NSArray.self, NSString.self]

    }

Just to be clear, as J-NIC wrote in a comment, adding additional classes to the unarchiver is what worked for me. In my case I just needed to add NSString:

let mySpecialObject = try? NSKeyedUnarchiver.unarchivedObject(ofClasses:[MySpecialClass.self, NSString.self] ...

  • thx, its helpful.

Add a Comment

I had the same problem in Swift with iOS 15 / Xcode 13.2.

I solved it by simply adding NSNumber (the offending class listed in the warning) in the list of classes decoder.decodeObject of required init(coder decoder: NSCoder) { }

(I edited the class names). MyVar contains some numbers.

    required init(coder decoder: NSCoder) {
        
        myVar = decoder.decodeObject(of: [MyType.self, NSNumber.self], forKey: theKey) as? [MyVar] ?? []
    }
  • thx, its helpful.

Add a Comment