I'm having an unsolved bug in my code. The following code-snippet is working well within the simulator but not on a real iPhone device (tested on an iPhone SE 1.gen and iPhone 8, both with iOS 14.0.1.
The line "if let nnSData = NSData(...)" is still working within the simulator but not on real Hardware.
Could it be a bug in NSData? Or a bug in iOS? Or do I have a security problem with user rights of the file containing the data I want to read?
Comments would be appreciated.
******************************************************
static func loadBaseaArray() -> [Basea]? {
let fullPath = URL(fileURLWithPath: urlpathAa.path)
//the following works in Simulator only::::::::::::::::::::::::::::::::
if let nnsData = NSData(contentsOf: fullPath)
do {
let data = Data(referencing:nnsData)
if let result = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) {
return (result as? [BaseaClass])?.map{$0.basea}
.......***********************************************************