React-native-iap: [解決済み] RNIap.getSubscriptionsエラー:[TypeError:undefined is not a object(evaluating'RNIapIos.getItems ')]

作成日 2018年06月21日  ·  4コメント  ·  ソース: dooboolab/react-native-iap

react-native-iapのバージョン

1.20

エラーに直面したプラットフォーム(IOSまたはAndroid、あるいはその両方?)

iOSでのみテスト済み

予想される行動

サブスクリプションのリストを取得する

実際の動作

RNIap.getSubscriptionsエラー:[TypeError:undefined is not a object(evaluating'RNIapIos.getItems ')]

テストされた環境(エミュレーター?実デバイス?)

両方とも

動作を再現する手順

「」
const itemSkus = Platform.select({
ios:[
'com.shares.sharesapp'、// ['BASIC'、 'C​​LASSIC'、 'MAX'、 'PLUS']も試しました。
]、
アンドロイド:[
'com.shares.sharesapp'、
]、
});

非同期componentDidMount(){
{を試してください
RNIap.prepare();を待つ
}
キャッチ(err1){
console.log( "RNIap.prepareエラー:"、err1);
}
最後に {
console.log( "finally");
{を試してください
const products = await RNIap.getSubscriptions(itemSkus);
console.log( 'サブスクリプション'、製品);
}
キャッチ(エラー){
console.log( "RNIap.getSubscriptionsエラー:"、err);
}
}
}
「」
シミュレーターでサンドボックスアカウントに接続できません
capture d ecran 2018-06-20 a 15 37 42

そして実際のデバイスでは、これらのポップアップがあります
photo

これがAppStoreConnectのサブスクリプションのリストです
capture d ecran 2018-06-20 a 12 42 30

誰かがこれを良い形にセットアップするのを手伝ってくれませんか?

📱 iOS 🙏 help wanted

最も参考になるコメント

説明されているように手動でインストールする必要がありました...
「」
手動インストール
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)

「」

全てのコメント4件

私も試してみました
const purchases = await RNIap.getAvailablePurchases(); console.info('Available purchases :: ', purchases);
同じ結果:
RNIap.getSubscriptions error : [TypeError: undefined is not an object (evaluating 'RNIapIos.getAvailableItems')]

また、App StoreConnectでProductIDを「com.shares.sharesapp.basic」として変更するには

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)

「」

今回は、接続するように求められた後(最初に実際のデバイスで切断します)、サンドボックスユーザーを入力し、サブスクリプションの詳細を取得することができました👍
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", }, ]

参考までに、RNIap.getSubscriptions(itemSkus)はシミュレーターでも機能します。

このページは役に立ちましたか?
0 / 5 - 0 評価