Skip to content

Commit 1502970

Browse files
committed
fix(capacitor-ios): bypass reject() entirely, call errorHandler directly
reject() is a Swift extension method that the SPM precompiled xcframework doesn't export at all. Call the ObjC errorHandler property with CAPPluginCallError directly instead.
1 parent 400f77d commit 1502970

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

capacitor/ios/Sources/PurchasePlugin/PurchasePlugin.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,9 @@ 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 default parameter values, so all 4 args must be explicit.
380+
/// The xcframework doesn't export Swift extension methods like reject(), so we call errorHandler directly.
381381
private func rejectCall(_ call: CAPPluginCall, _ message: String) {
382-
let noCode: String? = nil
383-
let noError: Error? = nil
384-
let noData: [String: Any]? = nil
385-
call.reject(message, noCode, noError, noData)
382+
call.errorHandler(CAPPluginCallError(message: message, code: nil, error: nil, data: [:]))
386383
}
387384

388385
private func debugLog(_ msg: String) {

0 commit comments

Comments
 (0)