swift – native ios module for yandexnavi


I’m making a local ios module for yandexnavi. The module has been efficiently created and I’m passing geolocation knowledge to it. Subsequent, I take advantage of the code from the Yandex directions.
However I get an error – Deadly error: Unexpectedly discovered nil whereas unwrapping an Optionally available worth.
On the finish of the operate:

func loadCert() -> SecKey {
  let certificateData = NSData(
    contentsOf:Bundle.most important.url(forResource: "private_key", withExtension: "der")!
  )

  let choices: [String: Any] =
    [kSecAttrKeyType as String: kSecAttrKeyTypeRSA,
    kSecAttrKeyClass as String: kSecAttrKeyClassPrivate,
    kSecAttrKeySizeInBits as String: 512]

  let key = SecKeyCreateWithData(certificateData!,
    choices as CFDictionary,
    nil)
  return key! //Deadly error: Unexpectedly discovered nil whereas unwrapping an Optionally available worth.
}

It appears that evidently the important thing file isn’t appropriate, but when the useful resource file isn’t appropriate, then I get a very completely different error

Similar Posts

Leave a Reply

Your email address will not be published.