问题描述
在我的应用获得 App Store Connect 批准之前,一切正常。
当我的 IAP 处于“准备提交”状态时,我的产品很好。但是现在,它处于“已批准”状态,我的产品带有空标题和描述。价格和标识符没问题。
即使在使用 Magic Weather example app from RevenueCat 时我也遇到了同样的问题。
这是我的代码:
Future<void> _initPlatformState() async {
await Purchases.setup("******************************",appUserId: null);
Purchases.addPurchaserInfoUpdateListener((info) {
_checkIfVIP(info);
});
try {
purchaserInfo = await Purchases.getPurchaserInfo();
print('PurchaserInfo: ' + purchaserInfo.toString());
//_checkIfVIP(purchaserInfo);
} on PlatformException catch (e) {
print('PlatformException: ' + e.toString());
}
print('is user vip? ' + isVIP.toString());
}
void _checkIfVIP(PurchaserInfo purchaserInfo) {
if (purchaserInfo != null && purchaserInfo.entitlements.all['vip'] != null) {
setIsVIP(purchaserInfo.entitlements.all['vip'].isActive);
} else {
setIsVIP(false);
}
notifyListeners();
}
Offerings _offerings;
Future<Offerings> getofferings() async {
Offerings offerings;
if (_offerings != null)
offerings = _offerings;
else {
try {
offerings = await Purchases.getofferings();
} on PlatformException catch (e) {
print(e.toString());
}
}
print(offerings.toString());
return offerings;
}
和
Future<void> doPurchase() async {
try {
if (_offerings != null) {
_toggleLoadingState();
PurchaserInfo purchaserInfo = await Purchases.purchasePackage(_offerings.current.monthly);
// the native purchase window should open before going forward
if (purchaserInfo.entitlements.all["vip"].isActive) {
MainModel mainModel = Provider.of<MainModel>(context,listen: false);
mainModel.setIsVIP(true);
showDialog(
context: context,builder: (BuildContext context) {
return AlertDialog(
title: new Text(S.current.welcome_to_the_vip_group),content: new Text(
S.current.purchase_success,textAlign: TextAlign.center,),actions: <Widget>[
new TextButton(
child: new Text(S.current.close),onpressed: () => {popToPrevIoUsPage(context)},],);
},);
} else {
print('purchaserInfo.entitlements.all["vip"].toString());
_toggleLoadingState();
}
}
} on PlatformException catch (e) {
_toggleLoadingState();
var errorCode = PurchasesErrorHelper.getErrorCode(e);
showDialog(
context: context,builder: (BuildContext context) {
if (errorCode == PurchasesErrorCode.purchaseCancelledError) {
return AlertDialog(
title: new Text(''),content: new Text(
S.current.purchase_canceled_error,actions: <Widget>[
new TextButton(
child: new Text(S.current.close),onpressed: () => Navigator.pop(context),);
} else if (errorCode == PurchasesErrorCode.storeProblemError) {
return AlertDialog(
title: new Text(S.current.oops),content: new Text(S.current.purchase_store_problem_error(Platform.isAndroid ? 'Google Play' : 'App Store')),);
} else {
return AlertDialog(
title: new Text(S.current.oops),content: new Text(S.current.purchase_default_error),);
}
},);
print('isLoadingSomething = ' + e.toString());
}
}
这是来自 Magic Weather 应用程序的日志:
Flutter run
Launching lib/main.dart on iPhone de **** in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: ********
Running Xcode build...
└─Compiling,linking and signing... 6,7s
Xcode build done. 12,1s
Installing and launching... 13,3s
Syncing files to device iPhone de ******... 75ms
Flutter run key commands.
r Hot reload. ???
R Hot restart.
h List all available interactive commands.
d Detach (terminate "Flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
An Observatory debugger and profiler on iPhone de ***** is available at: http://127.0.0.1:50626/3xLvY2V4t7c=/
[Purchases] - DEBUG: ℹ️ Debug logging enabled
[Purchases] - DEBUG: ℹ️ SDK Version - 3.11.1
[Purchases] - DEBUG: ? Initial App User ID - (null)
[Purchases] - DEBUG: ℹ️ Sending latest PurchaserInfo to delegate.
[Purchases] - DEBUG: ℹ️ Delegate set
[Purchases] - DEBUG: ℹ️ There are no requests currently running,starting request GET /subscribers/$RCAnonymousID0X0P+09303b005bcc24f1a83115fa2a44c4a11
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/$RCAnonymousID:9303b005bcc24f1a83115fa2a44c4a11
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/$RCAnonymousID:9303b005bcc24f1a83115fa2a44c4a11/offerings
The Flutter DevTools debugger and profiler on iPhone de ****** is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:50626/3xLvY2V4t7c=/
[connection] nw_endpoint_handler_set_adaptive_read_handler [C1.1 54.90.18.6:443 ready channel-flow (satisfied (Path is satisfied),viable,interface: en0,ipv4,dns)] unregister notification for read_timeout Failed
[connection] nw_endpoint_handler_set_adaptive_write_handler [C1.1 54.90.18.6:443 ready channel-flow (satisfied (Path is satisfied),dns)] unregister notification for write_timeout Failed
[Purchases] - DEBUG: ℹ️ API request completed with status: GET /v1/subscribers/$RCAnonymousID:9303b005bcc24f1a83115fa2a44c4a11 200
[Purchases] - DEBUG: ℹ️ Serial request done: GET /subscribers/$RCAnonymousID0X0P+09303b005bcc24f1a83115fa2a44c4a11,0 requests left in the queue
[Purchases] - DEBUG: ℹ️ API request completed with status: GET /v1/subscribers/$RCAnonymousID:9303b005bcc24f1a83115fa2a44c4a11/offerings 200
[Purchases] - DEBUG: ℹ️ Requesting products from the store with identifiers: {(
0001
)}
[Purchases] - DEBUG: ℹ️ Products request finished.
[Purchases] - DEBUG: ? Retrieved SKProducts:
[Purchases] - DEBUG: ? 0001 - <SKProduct: 0x280ea0030>
[Purchases] - DEBUG: ℹ️ 1 completion handlers waiting on products
[Purchases] - DEBUG: ℹ️ vending PurchaserInfo from cache.
[Purchases] - DEBUG: ℹ️ vending Offerings from cache
Android 上的一切都很好,App Store Connect 上的一切似乎都很好。
我也在他们的 github 页面(here 和 here)上报告了这个问题,但没有任何帮助。
知道会发生什么吗?我什至尝试更改我的产品名称,看看它是否能解决问题,但没有成功。
已经挣扎了几个星期。不知道该怎么办了。
解决方法
事实证明,flutter SDK 上的某些内容已损坏。我删除并重新下载了 Flutter SDK,它工作正常。
奇怪。