1.20
تم اختباره على نظام iOS فقط
احصل على قائمة الاشتراكات
خطأ RNIap.getSubscriptions: [TypeError: undefined ليس كائنًا (تقييم 'RNIapIos.getItems')]
على حد سواء
""
const itemSkus = Platform.select ({
iOS: [
'com.shares.sharesapp'، // حاولت أيضًا ['BASIC'، 'CLASSIC'، 'MAX'، 'PLUS'] ..
] ،
ذكري المظهر: [
"com.shares.sharesapp"،
] ،
}) ؛
componentDidMount () {غير متزامن
محاولة {
انتظار RNIap.prepare () ؛
}
قبض (خطأ 1) {
console.log ("RNIap.prepare error:"، err1)؛
}
أخيرا {
console.log ("أخيرًا") ؛
محاولة {
منتجات const = انتظار RNIap.getSubscriptions (itemSkus) ؛
console.log ("الاشتراكات" ، المنتجات) ؛
}
قبض (يخطئ) {
console.log ("خطأ RNIap.getSubscriptions:"، err)؛
}
}
}
""
لا يمكنني الاتصال بحساب sandbox في المحاكاة
وفي جهاز حقيقي ، وجود هذه النوافذ المنبثقة
فيما يلي قائمة الاشتراكات في App Store Connect
هل يمكن لأي شخص مساعدتي في إعداد هذا في حالة جيدة؟
أنا أيضا حاولت مع
const purchases = await RNIap.getAvailablePurchases();
console.info('Available purchases :: ', purchases);
النتيجة نفسها:
RNIap.getSubscriptions error : [TypeError: undefined is not an object (evaluating 'RNIapIos.getAvailableItems')]
ولتغيير ProductID إلى "com.shares.sharesapp.basic" في App Store Connect و
const itemSkus = Platform.select({
ios: [
'com.shares.sharesapp.basic'
],
لا مزيد من النجاح ...
اضطررت إلى التثبيت يدويًا كما هو موضح ...
""
التثبيت اليدوي
iOS
In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-iap and add RNIap.xcodeproj
In XCode, in the project navigator, select your project. Add libRNIap.a to your project's Build Phases ➜ Link Binary With Libraries
Run your project (Cmd+R)
""
هذه المرة بعد أن طلبت مني الاتصال (قطع الاتصال بجهازك الحقيقي أولاً) ، دخلت إلى مستخدم Sandbox ، وتمكنت من الحصول على تفاصيل الاشتراك 👍
async componentDidMount() {
try {
await RNIap.prepare();
}
catch (err1) {
console.log("RNIap.prepare error : ", err1);
}
finally {
console.log("finally");
try {
console.log("itemSkus : ", itemSkus);
const products = await RNIap.getSubscriptions(itemSkus);
console.log('Subscriptions', products);
}
catch (err) {
console.log("RNIap.getSubscriptions error : ", err);
}
}
}
النتائج :
itemSkus : Array [
"com.shares.sharesapp.basic",
]
Subscriptions Array [
Object {
"currency": "EUR",
"description": "***",
"localizedPrice": "3,99 €",
"price": "3.99",
"productId": "com.shares.sharesapp.basic",
"title": "Abonnement BASIQUE",
"type": "Do not use this. It returned sub only before",
},
]
FYI، RNIap.getSubscriptions (itemSkus) يعمل أيضًا في المحاكاة.
التعليق الأكثر فائدة
اضطررت إلى التثبيت يدويًا كما هو موضح ...
""
التثبيت اليدوي
iOS
""