Repository navigation
Closed
flutter/packages
#8324Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.24Found to occur in 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: in_app_purchasePlugin for in-app purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Steps to reproduce
- enable Storekit2
InAppPurchaseStoreKitPlatform.enableStoreKit2();- make a product purchase and get a
PurchaseDetailsin_listenToPurchaseUpdate()callback
Future<void> _handleReportedPurchaseState(PurchaseDetails purchaseDetails) async {
...
...
if (purchaseDetails.pendingCompletePurchase) {
await _iapStoreKitPlatform.completePurchase(purchaseDetails);
}
}
}- You will find
completePurchase()never finish andawaitis forever 😅
Expected results
await completePurchase() should return or throw exception
Actual results
await completePurchase() never return forever!
Code sample
Default sample code is enough
https://github.com/flutter/packages/blob/main/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart
Screenshots or Video
No response
Logs
I dig into in_app_purchase_storekit plugin native code, and find some clue about this issue:
Check this code
/// Wrapper method around StoreKit2's finish() method https://developer.apple.com/documentation/storekit/transaction/3749694-finish
func finish(id: Int64, completion: @escaping (Result<Void, Error>) -> Void) {
Task {
let transaction = try await fetchTransaction(by: UInt64(id))
if let transaction = transaction {
await transaction.finish()
}
}
}completion closure was never used in finish(id:completion:)
Flutter Doctor output
Doctor output
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.2 24C101 darwin-arm64, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.95.3)
[✓] Connected device (5 available)
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.24Found to occur in 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: in_app_purchasePlugin for in-app purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Activity
codingiran commentedon Dec 12, 2024
@LouiseHsu Please check it, Thanks!
[-][in_app_purchase_storekit] StoreKit2 call completePurchase() await forver[/-][+][in_app_purchase_storekit] StoreKit2 call completePurchase() await forever[/+]darshankawar commentedon Dec 12, 2024
Thanks for the report. Using the code sample provided, I was able to replicate the reported behavior. It gets stuck at below:
https://github.com/flutter/packages/blob/cbdb48a0bcee5865e6e5d29826d6f44cc1f0984d/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart#L241
[in_app_purchase_storekit] fix finish() not completing (flutter#8324)
github-actions commentedon Jan 21, 2025
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 -vand a minimal reproduction of the issue.[in_app_purchase_storekit] fix finish() not completing (flutter#8324)
[in_app_purchase_storekit] fix finish() not completing (flutter#8324)
[in_app_purchase_storekit] fix finish() not completing (flutter#8324)
[in_app_purchase_storekit] fix finish() not completing (flutter#8324)