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_store_kit] 'Null check operator used on a null value' is thrown on calling SKPaymentQueueWrapper.transactions(). #143177

Closed
agent515 opened this issue Feb 8, 2024 · 8 comments · Fixed by flutter/packages#6139
Assignees
Labels
c: crash Stack traces logged to the console fyi-ecosystem For the attention of Ecosystem team p: in_app_purchase Plugin for in-app purchase package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team

Comments

@agent515
Copy link

agent515 commented Feb 8, 2024

Steps to reproduce

Not entirely sure how to reproduce the error. As it seemed to work for a brief period of time and then started throwing error. Maybe after some failed or pending transactions. (Sandbox Environment)

  • Make a few purchases buyNonConsumable.
  • After some pending or failed transactions, call SKPaymentQueueWrapper().transactions()

Expected results

All previous failed or pending transactions are completed or cleared without any error.

Actual results

Error: Null check operator used on a null value

Code sample

Code sample
 Future finishQueueTransactions() async {
    final transactions = await SKPaymentQueueWrapper().transactions();
    for (final element in transactions) {
      await SKPaymentQueueWrapper().finishTransaction(element);
    }
  }

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
flutter: Null check operator used on a null value
flutter: #0      SKErrorMessage.decode (package:in_app_purchase_storekit/src/messages.g.dart:190:24)
#1      SKPaymentTransactionMessage.decode (package:in_app_purchase_storekit/src/messages.g.dart:111:28)
#2      SKPaymentTransactionMessage.decode (package:in_app_purchase_storekit/src/messages.g.dart:106:41)
#3      _InAppPurchaseAPICodec.readValueOfType (package:in_app_purchase_storekit/src/messages.g.dart:297:44)
#4      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#5      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:522:23)
#6      _InAppPurchaseAPICodec.readValueOfType (package:in_app_purchase_storekit/src/messages.g.dart:301:22)
#7      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#8      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:522:23)
#9      _InAppPurchaseAPICodec.readValueOfType (package:in_app_purchase_storekit/src/messages.g.dart:301:22)
#10     StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#11     StandardMessageCodec.decodeMessage (package:flutter/src/services/message_codecs.dart:341:28)
#12     BasicMessageChannel.send (package:flutter/src/services/platform_channel.dart:206:18)
<asynchronous suspension>
#13     InAppPurchaseAPI.transactions (package:in_app_purchase_storekit/src/messages.g.dart:357:9)
<asynchronous suspension>
#14     SKPaymentQueueWrapper.transactions (package:in_app_purchase_storekit/src/store_kit_wrappers/sk_payment_queue_wrapper.dart:63:9)

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.8, on macOS 14.2 23C64 darwin-arm64, locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.86.1)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

Device: iPhone 14 (iOS 17.2.1)

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Feb 9, 2024
@darshankawar
Copy link
Member

Thanks for the bug report @agent515
The log seems to be pointing to in_app_purchase_storekit package which is newly published https://pub.dev/packages/in_app_purchase_storekit
Are you directly / explicitly using this package in your app ?

Also, the code sample you provided, does it throw the same exception if you try to run it locally in debug mode on same iOS version ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 9, 2024
@agent515
Copy link
Author

agent515 commented Feb 9, 2024

Hi @darshankawar .

The log seems to be pointing to in_app_purchase_storekit package which is newly published https://pub.dev/packages/in_app_purchase_storekit
Are you directly / explicitly using this package in your app ?

I tried both approaches. Indirectly using through just in_app_purchase: ^3.1.5 and also explicitly adding in_app_purchase_storekit: ^0.3.9 in pubspec.yaml. I had noticed this recently merged PR related to this but I'm not sure if it actually fixes the issue. I tried the latest store_kit code by downloading files and using path in pubspec.yaml but the issue persists.

Also, the code sample you provided, does it throw the same exception if you try to run it locally in debug mode on same iOS version?

Yes, facing this locally in debug version. The In App Purchase isn't in the production yet.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 9, 2024
@zahoorahmadgorsi

This comment was marked as duplicate.

@darshankawar
Copy link
Member

Thanks for the update. I tried using the code snippet provided using the plugin example, but I wasn't able to replicate it.
Maybe I wasn't able to setup properly, but based on the report and exception triggered, keeping the issue open for team's input / attention.

@darshankawar darshankawar added platform-ios iOS applications specifically p: in_app_purchase Plugin for in-app purchase package flutter/packages repository. See also p: labels. team-ios Owned by iOS platform team fyi-ecosystem For the attention of Ecosystem team c: crash Stack traces logged to the console and removed in triage Presently being triaged by the triage team labels Feb 12, 2024
@jmagman
Copy link
Member

jmagman commented Feb 12, 2024

cc @LouiseHsu

@LouiseHsu LouiseHsu self-assigned this Feb 13, 2024
@LouiseHsu
Copy link
Contributor

Tried to repro this bug, but I don't seem to be able to. Going off the stacktrace, I added some extra checks in flutter/packages#6032, so please try upgrading and see if that mitigates the issue! Will leave this issue open for now just in case.

@jmagman jmagman added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 14, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this issue Feb 16, 2024
@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Feb 16, 2024
@agent515
Copy link
Author

@LouiseHsu It's resolved. Thanks!

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 16, 2024
@github-actions github-actions bot reopened this Feb 16, 2024
Copy link

github-actions bot commented Mar 1, 2024

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 Mar 1, 2024
arc-yong pushed a commit to Arctuition/packages-arc that referenced this issue Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console fyi-ecosystem For the attention of Ecosystem team p: in_app_purchase Plugin for in-app purchase package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants