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] Host platform returned null value for non-null return value #148601

Open
meowofficial opened this issue May 18, 2024 · 3 comments
Assignees
Labels
c: crash Stack traces logged to the console p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@meowofficial
Copy link

Steps to reproduce

I got PlatformException(null-error, Host platform returned null value for non-null return value., null, null) in Sentry on production after calling SKPaymentQueueWrapper().storefront(). So far the issue occured only for one user.

package: in_app_purchase_storekit 0.3.14
device: iPhone 11
OS: iOS 17.4.1

Expected results

No error

Actual results

PlatformException(null-error, Host platform returned null value for non-null return value., null, null)

Code sample

Code sample
final storefront = await SKPaymentQueueWrapper().storefront();

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel beta, 3.22.0-0.3.pre, on macOS 14.4.1 23E224 darwin-arm64, locale ru-RU)
    • Flutter version 3.22.0-0.3.pre on channel beta at /Users/admin/Application Support/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 87b652410d (3 weeks ago), 2024-04-23 21:41:18 -0500
    • Engine revision b4bfd45986
    • Dart version 3.4.0 (build 3.4.0-282.3.beta)
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/admin/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/admin/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode-15.3.0.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 79.0.3
    • Dart plugin version 241.15989.9

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (5 available)
    • iPad (Evgeniy) (mobile)         • 00008020-001029592629402E            • ios            • iOS 17.1.2 21B101
    • iPhone 15 Pro (mobile)          • 7FE5FD9E-3748-405C-A6F2-F50CD2509BAD • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 124.0.6367.208

[✓] Network resources
    • All expected network resources are available.

• No issues found!
@stuartmorgan
Copy link
Contributor

https://github.com/flutter/packages/blob/a99c7f5f5710f2bd63e873c5560093787baa9f51/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/InAppPurchasePlugin.swift#L119-L122 isn't consistent with the Pigeon definition; both return lines can return nil, but the Pigeon definition says the return type is non-nullable. Either the Pigeon definition needs to change, or any nil value needs to set the out error (which is the reason the output shows as nullable on the native side per this comment).

Converting the generated code to Swift will help avoid this kind of thing since the non-nullable return types will actually become non-nullable since Swift uses throw rather than out errors.

@stuartmorgan stuartmorgan added c: crash Stack traces logged to the console 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 labels May 18, 2024
@jmagman
Copy link
Member

jmagman commented May 20, 2024

cc @LouiseHsu

@jmagman jmagman added P2 Important issues not at the top of the work list triaged-ios Triaged by iOS platform team labels May 22, 2024
@jmagman
Copy link
Member

jmagman commented May 22, 2024

Assigning to @LouiseHsu as part of #119106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: crash Stack traces logged to the console p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
None yet
Development

No branches or pull requests

4 participants