Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[in_app_purchase] iOS app crash when InAppPurchaseConnection.instance.buyNonConsumable(purchaseParam: purchaseParam); called #65767

Closed
gumilar1995 opened this issue Sep 14, 2020 · 7 comments
Labels
p: in_app_purchase Plugin for in-app purchase P1 High-priority issues at the top of the work list package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically

Comments

@gumilar1995
Copy link

gumilar1995 commented Sep 14, 2020

My app crash immediately when InAppPurchaseConnection.instace.buyNonConsumable() method called.
It was fine when using flutter 1.17.x and in_app_purchase 0.3.4

Steps to Reproduce

Here is my pubspec.yaml dependencies

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
flutter_sticky_header: ^0.5.0
video_player: '>=0.10.12+2 <2.0.0'
screen: ^0.0.5
device_info: '>=0.4.2+7 <2.0.0'
http: ^0.12.2
shared_preferences: '>=0.5.10 <2.0.0'
connectivity: '>=0.4.9+2 <2.0.0'
shimmer: ^1.1.1
rxdart: ^0.24.1
transparent_image: ^1.0.0
share: '>=0.6.5 <2.0.0'
url_launcher: ^5.5.2
flutter_launcher_icons: ^0.7.5
uni_links: ^0.4.0
flutter_svg: ^0.18.1
package_info: '>=0.4.3 <2.0.0'
intl: ^0.16.1
cloud_firestore: ^0.14.0+2
firebase_analytics: ^6.0.0
cached_network_image: ^2.3.1
in_app_purchase: ^0.3.4+8
flutter_html: ^1.0.2
flutter_keychain:
git:
url: git://github.com/jeroentrappers/flutter_keychain

dev_dependencies:
flutter_test:
sdk: flutter
json_serializable: ^3.4.1
build_runner: ^1.10.0
json_annotation: ^3.0.1

Expected results: Payment confirmation pop up

Actual results: App crash

Flutter run --verbose ( latest logs on crash )
[ +3 ms] Flutter run key commands.
[ +8 ms] r Hot reload. 🔥🔥🔥
[ +48 ms] R Hot restart.
[ +3 ms] h Repeat this help message.
[ +5 ms] d Detach (terminate "flutter run" but leave application running).
[ +24 ms] c Clear the screen
[ +1 ms] q Quit (terminate the application on the device).
[ ] An Observatory debugger and profiler on Parwanto’s iPad is available at: http://localhost:55119
[+30377 ms] Service protocol connection closed.
[ ] Lost connection to device.
[ +6 ms] DevFS: Deleting filesystem on the device
(file:///private/var/mobile/Containers/Data/Application/76F315E0-273C-44FD-8CFC-982F198BF2DA/tmp/stro-tv-appsXcDnpk/stro-tv-apps/)
[ +254 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[ +3 ms] "flutter run" took 175,136ms.
[ +125 ms] ensureAnalyticsSent: 119ms
[ +1 ms] Running shutdown hooks
[ ] Shutdown hook priority 4
[ +2 ms] Shutdown hooks complete
[ ] exiting with code 0

Logs from debugging on xcode
2020-09-15 12:58:27.431217+0700 Runner[521:106414] -[NSNull boolValue]: unrecognized selector sent to instance 0x1ef5a7c00
2020-09-15 12:58:27.435407+0700 Runner[521:106414] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull boolValue]: unrecognized selector sent to instance 0x1ef5a7c00'
*** First throw call stack:
(0x1b38c8a48 0x1b35effa4 0x1b37cc5a8 0x1b38ccaf4 0x1b38cea7c 0x10108a7bc 0x101089278 0x1048c2e88 0x1040bb584 0x104384994 0x1040c4734 0x1040c6b64 0x1b384703c 0x1b3846d78 0x1b3846448 0x1b3841584 0x1b3840adc 0x1bd7c6328 0x1b793bae0 0x100601ef8 0x1b36ca360)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

UPDATED
Error on this line of code :
if (@available(iOS 8.3, *)) {
payment.simulatesAskToBuyInSandbox =
[[paymentMap objectForKey:@"simulatesAskToBuyInSandbox"] boolValue];

}

Flutter doctor -v
[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale en-ID)
• Flutter version 1.20.3 at /Users/anggagumilar/flutter
• Framework revision 216dee6 (13 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/anggagumilar/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.9.3

[!] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.48.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.14.1

[✓] Connected device (1 available)
• Parwanto’s iPad (mobile) • 9205677791ca656e51e7c0d70902f383b47b42d9 • ios • iOS 13.3

@gumilar1995
Copy link
Author

gumilar1995 commented Sep 15, 2020

SOLVED
[paymentMap objectForKey:@"simulatesAskToBuyInSandbox"] is having NULL value so I add some validation to the value

if([NSNull null] != [paymentMap objectForKey:@"simulatesAskToBuyInSandbox"]){
payment.simulatesAskToBuyInSandbox =
[[paymentMap objectForKey:@"simulatesAskToBuyInSandbox"] boolValue];
}

Hope this will be fixed on later version of in_app_purchase

andrewjallenuoft added a commit to andrewjallenuoft/plugins that referenced this issue Sep 19, 2020
Attempts to fix crash when InAppPurchaseConnection.instance.buyNonConsumable is called. Detailed here: flutter/flutter#65767
@Vardiak
Copy link

Vardiak commented Sep 27, 2020

This is a serious issue that has not been resolved in the latest version... Please reopen the issue.

@andrewjallenuoft
Copy link

I also encountered this issue but was able to solve it through explicitly specifying the sandboxTesting argument. Specifically,
sandboxTesting: !Foundation.kReleaseMode,

@Vardiak
Copy link

Vardiak commented Sep 27, 2020

Yes, this is how I solved on my app. I made a pull request to fix the default value.
flutter/plugins#3086

@cyanglaz cyanglaz reopened this Oct 2, 2020
@cyanglaz
Copy link
Contributor

cyanglaz commented Oct 2, 2020

This issue hasn't be resolved yet.

@cyanglaz
Copy link
Contributor

cyanglaz commented Oct 5, 2020

This is fixed with flutter/plugins#3110, closing the issue.

@cyanglaz cyanglaz closed this as completed Oct 5, 2020
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p: in_app_purchase Plugin for in-app purchase P1 High-priority issues at the top of the work list package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically
Projects
None yet
Development

No branches or pull requests

4 participants