如何修复错误:?? App Store 出现问题。(什么都试过了)

An_*_*aca 5 in-app-purchase ios dart flutter revenuecat

我目前遇到一个问题,用户无法在生产和测试中在 Apple App Store 上进行购买,这排除了沙盒帐户等(也已经沿着上述路线进行了)。相同的代码在 Android 上完美运行。

\n

我探索/尝试过的事情:

\n

正在删除并创建 Apple 的沙盒帐户。\n已检查我与 Apple 没有任何未完成的协议。\n确保已启用应用内购买。\n尝试使用旧版和新版 api 密钥配置purchasing_flutter 包。\n我确信还有更多,我不记得\xe2\x80\x99。\n错误如下所示:

\n
flutter: \\^[[38;5;12m\xe2\x94\x82  now trying to purchase<\xe2\x80\xa6>\n[Purchases] - DEBUG: \xe2\x84\xb9\xef\xb8\x8f Vending Offerings from cache\n[Purchases] - DEBUG: \xe2\x84\xb9\xef\xb8\x8f makePurchase\n[Purchases] - DEBUG:  Purchasing product from package  - finMonitor_1500_1y_1w0 in Offering App Access\n[Purchases] - DEBUG: \xe2\x84\xb9\xef\xb8\x8f PaymentQueue updatedTransaction: finMonitor_1500_1y_1w0 (null) ((null)) (null) - 0\n<SKPaymentQueue: 0x2824dfa00>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x282863960 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}\n[Purchases] - DEBUG: \xe2\x84\xb9\xef\xb8\x8f PaymentQueue updatedTransaction: finMonitor_1500_1y_1w0 (null) (Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x2828602a0 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x282863960 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}) (null) - 2\n[Purchases] - ERROR: \xe2\x80\xbc\xef\xb8\x8f There was a problem with the App Store.\n[Purchases] - DEBUG:  Finishing transaction finMonitor_1500_1y_1w0 (null) ((null))\n[Purchases] - DEBUG: \xe2\x84\xb9\xef\xb8\x8f PaymentQueue removedTransaction: finMonitor_1500_1y_1w0 (null) ((null) Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x2828602a0 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x282863960 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}) {\n    NSLocalizedDescription = "An unknown error occurred";\n    NSUnderlyingError = "Error Domain=ASDErrorDomain Code=500 \\"Unhandled exception\\" UserInfo={NSUnderlyingError=0x282863960 {Error Domain=AMSErrorDomain Code=301 \\"Invalid Status Code\\" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureRea\n\nflutter: \\^[[38;5;196m\xe2\x94\x82 \xe2\x9b\x94 Paywall Upgrade - Exception caught: Error code PurchasesErrorCode.storeProblemError<\xe2\x80\xa6>\n
Run Code Online (Sandbox Code Playgroud)\n

这是我用于购买的代码:

\n
onPressed: () async {  \nshowLoadingBanner(context, 'Purchase is progress...');  \ntry {    \nloggerInfo(logMessage: 'now trying to purchase');    \n_purchaserInfo = await Purchases.purchasePackage(widget.package);    \n\nloggerInfo(logMessage: 'purchase completed');    \npaywallData.isPro = _purchaserInfo.entitlements.all["App Access"]!.isActive;    \n\nloggerDebug(logMessage: 'is user pro? ${paywallData.isPro}');\nThe code continues for some dialog handling etc, but it never reaches the loggerInfo(logMessage: 'purchase completed');\n       \n
Run Code Online (Sandbox Code Playgroud)\n

widget.package是从上面的widget传递过来的,获取方式如下:

\n
return FutureBuilder(\n        future: _fetchOfferings(),\n        builder: (BuildContext context, AsyncSnapshot snapshot) {\n          if (snapshot.connectionState == ConnectionState.done && snapshot.data != null) {\n            Offerings offerings = snapshot.data;\n            final offering = offerings.current;\n            if (offering != null) {\n              final annual = offering.annual;\n              if (annual != null) {\n                return TopBarAgnosticNoIcon(\n                  text: "Welcome!",\n                  style: kSendButtonTextStyle(context),\n                  uniqueHeroTag: 'purchase_screen',\n                  child: Scaffold(\n                      backgroundColor: Theme.of(context).backgroundColor,\n\n                      body: Stack(children: [\n                        Center(\n                          child: SingleChildScrollView(\n                              child: Column(\n                            mainAxisSize: MainAxisSize.min,\n                            mainAxisAlignment: MainAxisAlignment.start,\n                            crossAxisAlignment: CrossAxisAlignment.center,\n                            children: <Widget>[\n                              Padding(\n                                padding: const EdgeInsets.all(18.0),\n                                child: Image.asset("assets/logos/finMonitor_Transparent.png"),\n                              ),\n                              Text(\n                                'Select the subscription plan to get started.',\n                                textAlign: TextAlign.center,\n                                style: kSendButtonTextStyle(context),\n                              ),\n                              Padding(\n                                padding: const EdgeInsets.all(8.0),\n                                child: PurchaseButton(package: annual),\n
Run Code Online (Sandbox Code Playgroud)\n

_fetchOfferings future 函数使用的代码是:

\n
Future<Offerings?> _fetchOfferings() async {\n    Offerings? offerings;\n    try {\n      offerings = await Purchases.getOfferings();\n    } on PlatformException catch (e) {\n      loggerError(logMessage: 'Paywall Upgrade - _fetchOfferings: Exception caught $e');\n      if (Platform.isAndroid) {\n        _showSnackBar(context, 'Issue fetching information for purchase, please check you are signed into the play store');\n      } else {\n        _showSnackBar(context, 'Issue fetching information for purchase, please check you are signed into the app store');\n      }\n    }\n    return offerings;\n  }\n
Run Code Online (Sandbox Code Playgroud)\n

最后,按照文档中所示配置 SDK,并进行一些条件调整:

\n
    await Purchases.setDebugLogsEnabled(true)\n        .whenComplete(() => loggerInfo(logMessage: 'setDebugLogsEnabled completed'));\n    if (Platform.isAndroid){\n      if ((username != null && username != '') && (password != null && password != '') && (custKey != null && custKey != '')) {\n        await Purchases.setup(apiAndroidRevenueKey, appUserId: '$username-$custKey');\n      }else{\n        await Purchases.setup(apiAndroidRevenueKey);\n      }\n\n    }\n    else if (Platform.isIOS){\n      if ((username != null && username != '') && (password != null && password != '') && (custKey != null && custKey != '')) {\n        await Purchases.setup(apiIosRevenueKey, appUserId: '$username-$custKey');\n      }else{\n        await Purchases.setup(apiIosRevenueKey);\n      }\n\n    loggerInfo(logMessage: 'After purchases.setup');\n  }\n
Run Code Online (Sandbox Code Playgroud)\n

任何帮助将不胜感激。

\n