質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,3 +25,87 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
3つ質問を出してしまいましたが、どれか1つでも結構ですのでご存知の方いらっしゃいましたらご教授ください。
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
------- 追記 -----------
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
下記 verifySubscription を行うメソッドを追記しました。
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
```Swift
|
44
|
+
|
45
|
+
func verifyPurchase (with PRODUCT_ID:String) {
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: "sharedSecret" )
|
50
|
+
|
51
|
+
SwiftyStoreKit.verifyReceipt(using: appleValidator) {(result) in
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
switch result {
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
case .success(let receipt):
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
//自動更新
|
64
|
+
|
65
|
+
let purchaseResult = SwiftyStoreKit.verifySubscription(ofType: .autoRenewable, productId: PRODUCT_ID, inReceipt: receipt)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
switch purchaseResult {
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
case .purchased:
|
74
|
+
|
75
|
+
UserDefaults.standard.set(1, forKey: PRODUCT_ID)
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
case .notPurchased:
|
80
|
+
|
81
|
+
break
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
case .expired( _, _):
|
86
|
+
|
87
|
+
UserDefaults.standard.set(nil, forKey: PRODUCT_ID)
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
case .error(let error):
|
94
|
+
|
95
|
+
print (error)
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```
|