소스 검색

Update SwiftyStoreKit.swift

The function purchaseProduct() can leave without calling the completion handler if none of the if-lets will work out. The added lines will call the completion handler with an unknown error.
Achim Breidenbach 6 년 전
부모
커밋
46b5747d98
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      SwiftyStoreKit/SwiftyStoreKit.swift

+ 3 - 0
SwiftyStoreKit/SwiftyStoreKit.swift

@@ -57,6 +57,9 @@ public class SwiftyStoreKit {
                 let userInfo = [ NSLocalizedDescriptionKey: "Invalid product id: \(invalidProductId)" ]
                 let error = NSError(domain: SKErrorDomain, code: SKError.paymentInvalid.rawValue, userInfo: userInfo)
                 completion(.error(error: SKError(_nsError: error)))
+            } else {
+                let error = NSError(domain: SKErrorDomain, code: SKError.unknown.rawValue, userInfo: nil)
+                completion(.error(error: SKError(_nsError: error)))
             }
         }
     }