1,20
Nur unter iOS getestet
Liste der Abonnements abrufen
RNIap.getSubscriptions-Fehler: [TypeError: undefined ist kein Objekt (Auswertung von 'RNIapIos.getItems')]
beide
`` ``
const itemSkus = Platform.select ({
ios: [
'com.shares.sharesapp', // Ich habe auch versucht ['BASIC', 'CLASSIC', 'MAX', 'PLUS'] ..
],
Android: [
'com.shares.sharesapp',
],
});
async componentDidMount () {
Versuchen {
warte auf RNIap.prepare ();
}}
catch (err1) {
console.log ("RNIap.prepare error:", err1);
}}
endlich {
console.log ("endlich");
Versuchen {
const products = warte auf RNIap.getSubscriptions (itemSkus);
console.log ('Abonnements', Produkte);
}}
catch (err) {
console.log ("RNIap.getSubscriptions error:", err);
}}
}}
}}
`` ``
Ich kann keine Verbindung mit dem Sandbox-Konto im Simulator herstellen
und in realen Geräten mit diesen Popup
Hier ist die Liste der Abonnements in App Store Connect
Kann mir bitte jemand helfen, dies in einem guten Zustand einzurichten?
Ich habe es auch mit versucht
const purchases = await RNIap.getAvailablePurchases();
console.info('Available purchases :: ', purchases);
Ergebnis gleich:
RNIap.getSubscriptions error : [TypeError: undefined is not an object (evaluating 'RNIapIos.getAvailableItems')]
Und um ProductID als "com.shares.sharesapp.basic" in App Store Connect und zu ändern
const itemSkus = Platform.select({
ios: [
'com.shares.sharesapp.basic'
],
Kein Erfolg mehr ...
Ich musste wie beschrieben manuell installieren ...
`` ``
Manuelle Installation
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)
`` ``
Dieses Mal, nachdem ich aufgefordert wurde, eine Verbindung herzustellen (zuerst auf Ihrem realen Gerät trennen), gab ich den Sandbox-Benutzer ein und konnte die Abonnementdetails abrufen
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);
}
}
}
Ergebnisse :
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",
},
]
Zu Ihrer Information, RNIap.getSubscriptions (itemSkus) funktioniert auch im Simulator.
Hilfreichster Kommentar
Ich musste wie beschrieben manuell installieren ...
`` ``
Manuelle Installation
iOS
`` ``