1.20
diuji di iOS saja
dapatkan daftar langganan
RNIap.getSubscriptions error: [TypeError: undefined bukan sebuah objek (mengevaluasi 'RNIapIos.getItems')]
kedua
`` ''
const itemSkus = Platform.select ({
ios: [
'com.shares.sharesapp', // Saya juga mencoba ['BASIC', 'CLASSIC', 'MAX', 'PLUS'] ..
],
android: [
'com.shares.sharesapp',
],
});
async componentDidMount () {
coba {
menunggu RNIap.prepare ();
}
tangkap (err1) {
console.log ("RNIap.prepare error:", err1);
}
akhirnya {
console.log ("akhirnya");
coba {
produk const = menunggu RNIap.getSubscriptions (itemSkus);
console.log ('Langganan', produk);
}
tangkap (err) {
console.log ("RNIap.getSubscriptions error:", err);
}
}
}
`` ''
Saya tidak dapat terhubung dengan akun kotak pasir di simulator
dan di perangkat nyata, memiliki munculan ini
Berikut adalah daftar langganan di App Store Connect
Bisakah seseorang membantu saya menyiapkan ini dalam kondisi yang baik?
Saya juga mencoba dengan
const purchases = await RNIap.getAvailablePurchases();
console.info('Available purchases :: ', purchases);
hasil yang sama:
RNIap.getSubscriptions error : [TypeError: undefined is not an object (evaluating 'RNIapIos.getAvailableItems')]
Dan untuk mengubah ProductID sebagai "com.shares.sharesapp.basic" di App Store Connect dan
const itemSkus = Platform.select({
ios: [
'com.shares.sharesapp.basic'
],
Tidak ada lagi kesuksesan ...
Saya harus menginstal secara manual seperti yang dijelaskan ...
`` ''
Instalasi manual
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)
`` ''
Kali ini setelah saya diminta untuk menghubungkan (putuskan sambungan di perangkat asli Anda terlebih dahulu), saya masuk ke pengguna Sandbox, saya bisa mendapatkan detail langganan 👍
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);
}
}
}
Hasil:
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) bekerja juga di simulator.
Komentar yang paling membantu
Saya harus menginstal secara manual seperti yang dijelaskan ...
`` ''
Instalasi manual
iOS
`` ''