Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.

Commit 4db4041

Browse files
hyochanclaude
andauthored
chore(ios): fix Swift 6 warnings and deprecated API usage (#3148)
## Summary - Fix Swift 6 compatibility warnings to prepare for Swift 6 migration - Suppress unused result warning for better code cleanliness Closes #3146 ## Changes ### RnIapHelper.swift - Add explicit `@unchecked Sendable` conformance to `OpenIapException` class ### HybridRnIap.swift - Capture `products` as local constant before `MainActor.run` closure to avoid Swift 6 concurrency warning - Add `_ =` to suppress unused result warning for `finishTransaction` ## Notes The deprecated API warnings (`validateReceiptIOS` and `requestPurchaseOnPromotedProductIOS`) are from the OpenIAP library itself and will be resolved when OpenIAP is updated with new APIs. ## Test plan - [x] `yarn typecheck` passes - [x] `yarn lint` passes 🤖 Generated with [Claude Code](https://claude.ai/code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved iOS in-app purchase internals to reduce concurrency issues and streamline transaction handling. * **Bug Fixes** * Reduced risk of transaction-related errors and unexpected behavior, improving reliability of purchases and completion flows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c2aec64 commit 4db4041

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

ios/HybridRnIap.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class HybridRnIap: HybridRnIapSpec {
132132
products.append(product)
133133
seenIds.insert(product.id)
134134
}
135-
await MainActor.run {
135+
await MainActor.run { [products] in
136136
products.forEach { self.productTypeBySku[$0.id] = $0.type.lowercased() }
137137
}
138138
RnIapLog.result(
@@ -327,7 +327,7 @@ class HybridRnIap: HybridRnIapSpec {
327327
let sanitizedPayload = RnIapHelper.sanitizeDictionary(purchasePayload)
328328
RnIapLog.payload("finishTransaction.nativePayload", sanitizedPayload)
329329
let purchaseInput = try OpenIapSerialization.purchaseInput(from: purchasePayload)
330-
try await OpenIapModule.shared.finishTransaction(purchase: purchaseInput, isConsumable: nil)
330+
_ = try await OpenIapModule.shared.finishTransaction(purchase: purchaseInput, isConsumable: nil)
331331
RnIapLog.result("finishTransaction", true)
332332
await MainActor.run {
333333
self.purchasePayloadById.removeValue(forKey: iosParams.transactionId)

ios/RnIapHelper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import OpenIAP
55
/// Similar to Android's OpenIapException, this wraps errors with JSON-serialized messages.
66
/// Uses NSError for better compatibility with Objective-C bridging in Nitro.
77
@available(iOS 15.0, *)
8-
class OpenIapException: NSError {
8+
class OpenIapException: NSError, @unchecked Sendable {
99
static let domain = "com.margelo.nitro.rniap"
1010

1111
convenience init(_ json: String) {

0 commit comments

Comments
 (0)