Core Data NSSecureCoding Problem

My iOS 13.2 Swift app is a type of SceneKit editor which uses Core Data to persist user edits. I'm wondering if Core Data might be associated with the message below since NSManagedObject is a subclass of NSObject and since a test app I created without Core Data does not cause the message to be displayed.


Although I haven't subclassed any SceneKit classes which support NSSecureCoding, and no other classes in the app use NSSecureCoding, the following message is displayed when a SCNScene is displayed in a SCNView:


[general] NSSecureCoding allowed classes list contains [NSObject class], which bypasses security by allowing any Objective-C class to be implicitly decoded. Consider reducing the scope of allowed classes during decoding by listing only the classes you expect to decode, or a more specific base class than NSObject.


This message is displayed only once even though a SCNScene can be reopened multiple times to reflect the user's edits.


Possible Causes

1. Some of the Core Data entities contain binary data properties used to display thumbnail images. However, when I comment-out the code associated with creating/displaying the thumbnails, the above message is still displayed. The thumbnail data is created with the following code which returns an optional data object. I wonder about this, because Swift bridges to NSData which is a subclass of NSObject.


static func createNonCachedItemThumbnailData(item: Item) -> Data? {

let appDelegate = UIApplication.shared.delegate as! AppDelegate

let dataSource = appDelegate.dataSource

guard let selectedDesign = dataSource.selectedDesign else { return nil }

let resourceSubdirectoryName = selectedDesign.uniqueID!

guard let bundleURL = Bundle.main.url(forResource: item.uniqueID!, withExtension: "png", subdirectory: resourceSubdirectoryName + ".scnassets") else { return nil }

guard let imageSource = CGImageSourceCreateWithURL(bundleURL as CFURL, nil) else { return nil }

/*

maxDimension is the lesser of the width or height of the UIImageView in ItemSCNNodeSelectionViewCell.

*/

let maxDimension: CGFloat = 64.0

let options: [NSString: Any] = [

kCGImageSourceThumbnailMaxPixelSize: maxDimension,

kCGImageSourceCreateThumbnailFromImageAlways: true]

guard let scaledImage = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) else { return nil }

return UIImage(cgImage: scaledImage).pngData()

}


2. One of the Core Data entities uses NSKeyedArchiver/NSKeyedUnarchiver to archive SCNMaterial as binary data. I didn't use the transformable type for this property, because I read that the transformable type doesn't notice changes when the context is saved. This code seems far from the problem, but the compiler may have noticed it.


Any help would be appreciated.

Replies

My app doesn't use Core Data, but I also see this message in the console when I'm testing the app on my iPhone.


I'd like to find out why I see this message, too.