Skip to content

Commit

Permalink
Add conditional macro to omit confirmIn argument for Swift versions b…
Browse files Browse the repository at this point in the history
…elow 5.9 (#2850)

fix #2830
As stated in the issue, an error occurs when attempting to build with
Swift versions below 5.9, so this is being fixed."
  • Loading branch information
islandryu authored Sep 21, 2024
1 parent ea83007 commit ba7918d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ios/RNIapIosSk2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,18 @@ class RNIapIosSk2iOS15: Sk2Delegate {

var result: Product.PurchaseResult?

#if swift(>=5.9)
if #available(iOS 17.0, tvOS 17.0, *) {
result = try await product.purchase(confirmIn: windowScene, options: options)
} else {
#if !os(visionOS)
result = try await product.purchase(options: options)
#endif
}
#elseif !os(visionOS)
result = try await product.purchase(options: options)
#endif

switch result {
case .success(let verification):
debugMessage("Purchase Successful")
Expand Down

0 comments on commit ba7918d

Please sign in to comment.