Я изучаю трепетание и реализовал in_app_purchase для Android и iOS, однако он отлично работает в обеих платформах, но имея приведенный ниже выпуск в iOS 18.3.1. Версия, которую я имею < /p>
in_app_purchase: ^3.1.13
< /code>
Я сталкиваюсь с этой проблемой < /p>
flutter: Purchase successful!
flutter: Purchase finally :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x20c8db910'
*** First throw call stack:
(0x1a266a5fc 0x19fbe5244 0x1a27c3174 0x1a266d5c8 0x1a266cef0 0x1a125bbf0 0x1cfc08f64 0x1cfc066a8 0x1cfc05d18 0x1cfc052f4 0x1cfc07811 0x1cfc09a29 0x1cfbe2ddd 0x1cfbe2ddd 0x1cfbe2ddd 0x1cfbde2c5 0x1cfbde419 0x1cfbde2c5 0x1adf8fe39)
libc++abi: terminating due to uncaught exception of type NSException
< /code>
Мой исходный код < /p>
Future purchasePlan(BasePlans basePlan, BuildContext context) async {
try {
isLoading.value = true;
print("purchasePlan called : " + basePlan.id.toString());
print("purchasePlan called : " + basePlan.productDetails!.title);
if (basePlan.productDetails == null) {
error.value = "Product not available for purchase.";
print("Product not available for purchase");
isLoading.value = false;
return;
}
purchasePending.value = true;
late PurchaseParam purchaseParam;
if (Platform.isAndroid) {
// Check for existing subscriptions
final GooglePlayPurchaseDetails? oldSubscription =
_getOldSubscription(basePlan.productDetails!, purchases);
purchaseParam = GooglePlayPurchaseParam(
productDetails: basePlan.productDetails!,
changeSubscriptionParam: (oldSubscription != null)
? ChangeSubscriptionParam(
oldPurchaseDetails: oldSubscription,
replacementMode: ReplacementMode.withoutProration)
: null,
);
} else {
print("basePlan.productDetails id: " + basePlan.productDetails!.id);
print("basePlan.productDetails title : " +
basePlan.productDetails!.title);
print("basePlan.productDetails description : " +
basePlan.productDetails!.description);
print("basePlan.productDetails price : " +
basePlan.productDetails!.price);
print("basePlan.productDetails rawPrice: " +
basePlan.productDetails!.rawPrice.toString());
print("basePlan.productDetails currencyCode: " +
basePlan.productDetails!.currencyCode.toString());
print("basePlan.productDetails currencySymbol: " +
basePlan.productDetails!.currencySymbol.toString());
purchaseParam = PurchaseParam(
productDetails: basePlan.productDetails!,
);
print("basePlan.purchaseParam : " + purchaseParam.productDetails.id);
print("basePlan.applicationUserName : " +
purchaseParam.applicationUserName.toString());
}
try {
await _inAppPurchasePlatform.buyNonConsumable(
purchaseParam: purchaseParam);
print("Purchase successful!");
} catch (e, stacktrace) {
print("Purchase failed: $e");
print("Stacktrace: $stacktrace");
rethrow; // Preserve the crash for further debugging
}
} catch (e) {
print("Purchase error : $e");
error.value = "Purchase error: $e";
purchasePending.value = false;
isLoading.value = false;
String errorMessage = e.toString();
String displayMessage = '';
// Check if the error contains the specific message
if (errorMessage.contains('storekit_duplicate_product_object')) {
displayMessage =
'There is a pending transaction for the same product identifier. Please either wait for it to be finished or finish it manually using `completePurchase` to avoid edge cases.';
} else {
displayMessage = 'An unexpected purchase error occurred: $errorMessage';
}
Get.snackbar(
"Something went wrong!",
displayMessage,
snackPosition: SnackPosition.BOTTOM,
);
return;
} finally {
print("Purchase finally : ");
isPurchasing.value = false; // Set to false when purchase is done
// isLoading.value = false;
}
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... to-flutter
Приложение iOS завершается при использовании in_app_purchase в 18.3.1 в Flutter ⇐ IOS
Программируем под IOS
1743330903
Anonymous
Я изучаю трепетание и реализовал in_app_purchase для Android и iOS, однако он отлично работает в обеих платформах, но имея приведенный ниже выпуск в iOS 18.3.1. Версия, которую я имею < /p>
in_app_purchase: ^3.1.13
< /code>
Я сталкиваюсь с этой проблемой < /p>
flutter: Purchase successful!
flutter: Purchase finally :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x20c8db910'
*** First throw call stack:
(0x1a266a5fc 0x19fbe5244 0x1a27c3174 0x1a266d5c8 0x1a266cef0 0x1a125bbf0 0x1cfc08f64 0x1cfc066a8 0x1cfc05d18 0x1cfc052f4 0x1cfc07811 0x1cfc09a29 0x1cfbe2ddd 0x1cfbe2ddd 0x1cfbe2ddd 0x1cfbde2c5 0x1cfbde419 0x1cfbde2c5 0x1adf8fe39)
libc++abi: terminating due to uncaught exception of type NSException
< /code>
Мой исходный код < /p>
Future purchasePlan(BasePlans basePlan, BuildContext context) async {
try {
isLoading.value = true;
print("purchasePlan called : " + basePlan.id.toString());
print("purchasePlan called : " + basePlan.productDetails!.title);
if (basePlan.productDetails == null) {
error.value = "Product not available for purchase.";
print("Product not available for purchase");
isLoading.value = false;
return;
}
purchasePending.value = true;
late PurchaseParam purchaseParam;
if (Platform.isAndroid) {
// Check for existing subscriptions
final GooglePlayPurchaseDetails? oldSubscription =
_getOldSubscription(basePlan.productDetails!, purchases);
purchaseParam = GooglePlayPurchaseParam(
productDetails: basePlan.productDetails!,
changeSubscriptionParam: (oldSubscription != null)
? ChangeSubscriptionParam(
oldPurchaseDetails: oldSubscription,
replacementMode: ReplacementMode.withoutProration)
: null,
);
} else {
print("basePlan.productDetails id: " + basePlan.productDetails!.id);
print("basePlan.productDetails title : " +
basePlan.productDetails!.title);
print("basePlan.productDetails description : " +
basePlan.productDetails!.description);
print("basePlan.productDetails price : " +
basePlan.productDetails!.price);
print("basePlan.productDetails rawPrice: " +
basePlan.productDetails!.rawPrice.toString());
print("basePlan.productDetails currencyCode: " +
basePlan.productDetails!.currencyCode.toString());
print("basePlan.productDetails currencySymbol: " +
basePlan.productDetails!.currencySymbol.toString());
purchaseParam = PurchaseParam(
productDetails: basePlan.productDetails!,
);
print("basePlan.purchaseParam : " + purchaseParam.productDetails.id);
print("basePlan.applicationUserName : " +
purchaseParam.applicationUserName.toString());
}
try {
await _inAppPurchasePlatform.buyNonConsumable(
purchaseParam: purchaseParam);
print("Purchase successful!");
} catch (e, stacktrace) {
print("Purchase failed: $e");
print("Stacktrace: $stacktrace");
rethrow; // Preserve the crash for further debugging
}
} catch (e) {
print("Purchase error : $e");
error.value = "Purchase error: $e";
purchasePending.value = false;
isLoading.value = false;
String errorMessage = e.toString();
String displayMessage = '';
// Check if the error contains the specific message
if (errorMessage.contains('storekit_duplicate_product_object')) {
displayMessage =
'There is a pending transaction for the same product identifier. Please either wait for it to be finished or finish it manually using `completePurchase` to avoid edge cases.';
} else {
displayMessage = 'An unexpected purchase error occurred: $errorMessage';
}
Get.snackbar(
"Something went wrong!",
displayMessage,
snackPosition: SnackPosition.BOTTOM,
);
return;
} finally {
print("Purchase finally : ");
isPurchasing.value = false; // Set to false when purchase is done
// isLoading.value = false;
}
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79544233/ios-app-terminating-while-using-in-app-purchase-into-18-3-1-into-flutter[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия