ソースを参照

Fixes for error reporting

Andrea Bizzotto 10 年 前
コミット
4851f7cffa
1 ファイル変更5 行追加1 行削除
  1. 5 1
      SwiftyStoreDemo/ViewController.swift

+ 5 - 1
SwiftyStoreDemo/ViewController.swift

@@ -7,6 +7,7 @@
 //
 
 import UIKit
+import StoreKit
 import SwiftyStoreKit
 
 class ViewController: UIViewController {
@@ -46,7 +47,10 @@ class ViewController: UIViewController {
                 print("Purchase Success: \(productId)")
                 break
             case .Error(let error):
-                if case ResponseError.RequestFailed(let internalError) = error where internalError.code == 0 {
+                if case ResponseError.RequestFailed(let internalError) = error where internalError.domain == SKErrorDomain {
+                    self.showMessage("Purchase failed", message: "Please check your Internet connection or try again later")
+                }
+                else if (error as NSError).domain == SKErrorDomain {
                     self.showMessage("Purchase failed", message: "Please check your Internet connection or try again later")
                 }
                 else {