Skip to content

Commit 4609e0e

Browse files
committed
fix(capacitor-ios): use typed locals in rejectCall for SPM binary compat
Bare nil literals have no contextual type in SPM precompiled context. Use typed local variables so the compiler can resolve the CAPPluginCallError initializer and errorHandler call.
1 parent 1502970 commit 4609e0e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

capacitor/ios/Sources/PurchasePlugin/PurchasePlugin.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,14 @@ public class PurchasePlugin: CAPPlugin, CAPBridgedPlugin {
377377
}
378378

379379
/// Wrapper for call.reject that works with both CocoaPods (source) and SPM (precompiled xcframework).
380-
/// The xcframework doesn't export Swift extension methods like reject(), so we call errorHandler directly.
380+
/// The xcframework doesn't export Swift extension methods or initializers with bare nil args,
381+
/// so we use typed locals to give the compiler enough context.
381382
private func rejectCall(_ call: CAPPluginCall, _ message: String) {
382-
call.errorHandler(CAPPluginCallError(message: message, code: nil, error: nil, data: [:]))
383+
let code: String? = nil
384+
let err: Error? = nil
385+
let data: [String: Any] = [:]
386+
let error = CAPPluginCallError(message: message, code: code, error: err, data: data)
387+
call.errorHandler(error)
383388
}
384389

385390
private func debugLog(_ msg: String) {

0 commit comments

Comments
 (0)