I have a line in a code which became deprecated, there are suggestions in XCode what to replace it with, but I can't get my head around the difference, these are my three lines which worked:
let path = NSBundle.mainBundle().pathForResource("example", ofType: ".p12")
let pkcs12Data = NSData.dataWithContentsOfMappedFile(path!)
let cf: CFDataRef = pkcs12Data as! CFDataRef
Now according to warning and suggestions I changed my code to:
let path = NSBundle.mainBundle().pathForResource("example", ofType: ".p12")
let pkcs12Data = NSData(contentsOfFile: path!)
let cf: CFDataRef = pkcs12Data as! CFDataRef
Which gives me an error:
EXC_BAD_INSTRUCTION (CODE=EXC_I386_INVOP SUBCODE=0x0)
CFDataCreate()
. – RedmerCFDataCreate(NULL, pkcs12Data.bytes, pkcs12Data.length)
? – Redmer/Users/user/code/xyz/CryptoOperations/CryptographyOperations/IdentityFileReader.swift:30:42: Cannot convert value of type '()' to expected argument type 'CFAllocator!'
– Hatchel/Users/user/code/xyz/CryptoOperations/CryptographyOperations/IdentityFileReader.swift:30:66: Cannot convert value of type 'UnsafePointer<Void>' (aka 'UnsafePointer<()>') to expected argument type 'UnsafePointer<UInt8>'
– Hatchel