Skip to content

razorpay_flutter iOS Release Build Crash: unrecognized selector onPaymentSuccess:andData: causing app crash after payment success #462

@Sumit-1109

Description

@Sumit-1109
Fatal Exception: NSInvalidArgumentException
-[razorpay_flutter.RazorpayDelegate onPaymentSuccess:andData:]: unrecognized selector sent to instance 0x1091129a0
0
CoreFoundation
__exceptionPreprocess
4
CoreFoundation
_CF_forwarding_prep_0
5
Razorpay
InternalRazorpay.swift:232
InternalRazorpay.paymentSuccess(str:dictVerification:) + 232
6
Razorpay
RazorpayCheckout+JSBridge.swift:639
RazorpayCheckoutVC.onSuccess(withData:) + 639
7
Razorpay
RazorpayCheckout+JSBridge.swift:75
specialized RazorpayCheckoutVC.userContentController(_:didReceive:) + 75
8
Razorpay
<compiler-generated>
@objc RazorpayCheckoutVC.userContentController(_:didReceive:)
9
WebKit
(Missing UUID 38f840de4cb93015b3cb931934d315b8)
27
UIKitCore
__51-[UIStatusBar_Base _setHidden:animationParameters:]_block_invoke_4
28
Runner
AppDelegate.swift
main
29
(Missing)

Description

My FlutterFlow app integrates razorpay_flutter plugin (version 1.4.0) to accept payments. While the payment portal works fine on Android and iOS emulator, the iOS release build crashes as the payment portal comes up and immediately after payment success with the following fatal error:
Fatal Exception: NSInvalidArgumentException -[razorpay_flutter.RazorpayDelegate onPaymentSuccess:andData:]: unrecognized selector sent to instance

The app also crashes similarly on payment cancellation due to a similar unrecognized selector for onPaymentError:description:andData:.
The issue seems related to native iOS delegate methods not being exposed correctly to Objective-C runtime in the razorpay_flutter plugin for release builds.

On most devices it does not even bring up the payment portal page.

Flutter Version :

Flutter 3.35.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 05db968908 (9 weeks ago) • 2025-08-25 10:21:35 -0700
Engine • hash abb725c9a5211af2a862b83f74b7eaf2652db083 (revision a8bfdfc394) (2 months ago) • 2025-08-22 23:51:12.000Z
Tools • Dart 3.9.0 • DevTools 2.48.0

Xcode Version :

Xcode Version: Not installed / No access to Xcode (FlutterFlow only)

Cocoapod Version :

Cocoapods:

- razorpay-pod: 1.4.0 (from Podfile.lock)
- Flutter plugin razorpay_flutter: 1.4.0
- iOS Deployment Target: 14.0 (from Podfile)

Steps To Reproduce

  1. Run app on iOS device in release mode (not emulator)
  2. Launch Razorpay payment portal and complete payment
  3. Observe immediate app crash with unrecognized selector exception after payment callback

Expected Results

  1. Payment portal opens successfully on iOS release build without crashing
  2. onPaymentSuccess and onPaymentError callbacks are received normally in release mode

Crashlytics Logs

Fatal Exception: NSInvalidArgumentException  
-[razorpay_flutter.RazorpayDelegate onPaymentSuccess:andData:]: unrecognized selector sent to instance 0x1091129a0  

(Full log attached as com.zakoop.enterprise.app_issue_f6602bcdc5ac71e2a3a4280b43758b86_crash_session_149900abfb99448ca47786ad55a9d5d4_DNE_0_v2_stacktrace.txt)

Snack, code example, screenshot, or link to a repository:

  1. Using FlutterFlow UI builder with razorpay_flutter plugin 1.4.0
  2. Full native stack trace attached for reference

com.zakoop.enterprise.app_issue_f6602bcdc5ac71e2a3a4280b43758b86_crash_session_149900abfb99448ca47786ad55a9d5d4_DNE_0_v2_stacktrace.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions