I keep running into this error. I've tried numerous things, could someone tell me where I've gone wrong at? heres my code:
let receiptFileURL = Bundle.main.appStoreReceiptURL
let receiptData = try? Data(contentsOf: receiptFileURL!)
let recieptString = receiptData?.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
guard let jsonDict: [String: AnyObject] = ["receipt-data" : recieptString! as AnyObject, "password" : IAPProduct.apiID.rawValue as AnyObject] else {
DispatchQueue.main.async {
self.performSegue(withIdentifier: "mainVC", sender: nil)
}
}
["receipt-data" : recieptString! as AnyObject, "password" : IAPProduct.apiID.rawValue as AnyObject]can't be nil, so it's not an optional, soguard letcan't be done. Why do you useguard letorif let? To unwrap an optional, no? Here there is no optional. - Larme