React-native-iap: [ํ•ด๊ฒฐ๋จ] RNIap.getSubscriptions ์˜ค๋ฅ˜ : [TypeError : undefined๋Š” ๊ฐœ์ฒด๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค ( 'RNIapIos.getItems'ํ‰๊ฐ€)]

์— ๋งŒ๋“  2018๋…„ 06์›” 21์ผ  ยท  4์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: dooboolab/react-native-iap

react-native-iap ๋ฒ„์ „

1.20

์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ ํ”Œ๋žซํผ (IOS ๋˜๋Š” Android ๋˜๋Š” ๋‘˜ ๋‹ค?)

iOS์—์„œ๋งŒ ํ…Œ์ŠคํŠธ ๋จ

์˜ˆ์ƒ๋˜๋Š” ํ–‰๋™

๊ตฌ๋… ๋ชฉ๋ก ๊ฐ€์ ธ ์˜ค๊ธฐ

์‹ค์ œ ํ–‰๋™

RNIap.getSubscriptions ์˜ค๋ฅ˜ : [TypeError : undefined๋Š” ๊ฐœ์ฒด๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค ( 'RNIapIos.getItems'ํ‰๊ฐ€).]

ํ…Œ์ŠคํŠธ ๋œ ํ™˜๊ฒฝ (์—๋ฎฌ๋ ˆ์ดํ„ฐ? ์‹ค์ œ ์žฅ์น˜?)

์–‘์ž ๋ชจ๋‘

ํ–‰๋™์„ ์žฌํ˜„ํ•˜๋Š” ๋‹จ๊ณ„

````
const itemSkus = Platform.select ({
ios : [
'com.shares.sharesapp', // [ 'BASIC', 'CLASSIC', 'MAX', 'PLUS']๋„ ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค ..
],
android : [
'com.shares.sharesapp',
],
});

async componentDidMount () {
{
๊ธฐ๋‹ค๋ฆฌ๊ณ  RNIap.prepare ();
}
catch (err1) {
console.log ( "RNIap.prepare ์˜ค๋ฅ˜ :", err1);
}
๋“œ๋””์–ด {
console.log ( "finally");
{
const ์ œํ’ˆ = ๋Œ€๊ธฐ RNIap.getSubscriptions (itemSkus);
console.log ( '๊ตฌ๋…', ์ œํ’ˆ);
}
catch (err) {
console.log ( "RNIap.getSubscriptions ์˜ค๋ฅ˜ :", err);
}
}
}
````
์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ์—์„œ ์ƒŒ๋“œ ๋ฐ•์Šค ๊ณ„์ •์œผ๋กœ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค
capture d ecran 2018-06-20 a 15 37 42

์‹ค์ œ ์žฅ์น˜์—์„œ๋Š” ์ด๋Ÿฌํ•œ ํŒ์—…์ด
photo

๋‹ค์Œ์€ App Store Connect์˜ ๊ตฌ๋… ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.
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 Store Connect์—์„œ 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 ๋“ฑ๊ธ‰