Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
課金処理とたたかう.pdf
Search
Nobuyuki Nishiyama
June 18, 2019
Programming
920
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
課金処理とたたかう.pdf
potatotips #62で発表したスライドです!
https://potatotips.connpass.com/event/129207/
Nobuyuki Nishiyama
June 18, 2019
More Decks by Nobuyuki Nishiyama
See All by Nobuyuki Nishiyama
C++ MIX #11 これどう読むの...?
5mingame2
0
530
ゲーム音楽が好きすぎて実機から録音したけど需要ありますか?
5mingame2
2
890
正規表現苦手なんです...
5mingame2
1
650
コントロールセンターとたたかう
5mingame2
2
2.4k
OpenGLを試すなら
5mingame2
0
690
Emacs meets Vim
5mingame2
1
790
タッチジェスチャーとたたかう
5mingame2
4
820
教えて!Xcode
5mingame2
4
1.9k
つかおう!滑らか移動
5mingame2
0
620
Other Decks in Programming
See All in Programming
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
250
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
300
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
3
1.8k
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
120
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
160
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
310
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
600
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
19k
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
1
1.9k
AWS Transform Customによる Spring Boot 2.xから4.xへのVerUp
satoshi256kbyte
2
100
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
580
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
160
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
How to make the Groovebox
asonas
2
2.3k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Docker and Python
trallard
47
4.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Practical Orchestrator
shlominoach
191
12k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Building AI with AI
inesmontani
PRO
1
1.2k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Believing is Seeing
oripsolob
1
200
Transcript
QPUBUPUJQT ՝ۚॲཧͱ͔ͨͨ͏ʂ ΅ͬͪήʔϜσϕϩού ࢁ৴ߦɹ
࡞ΞϓϦʮύζϧˍϞφʔΫʯ ສμϯϩʔυಥഁ
࣮՝ۚॲཧͷ࣮ॳΊͯʂ
ࠓͲ͖0CKFDUJWF$Ͱ՝ۚॲཧΛ ॻ͍ͨϨΞέʔεʂ
ʮ՝ۚͨ͠ΒΞϓϦ͕ىಈ͠ͳ͘ ͳͬͨʂʯ
खݩͷڥͰ࠶ݱͰ͖ͳ͍ʜ
ͱΓ͋͑ͣιʔείʔυΛಡΉ
͓ʁ // 課金成功時に記録を保存する void purchased(std::string id) { // 課金ID→内部ID std::map<std::string,
std::string> tbl{ { "PERCHASE01", "PERCHASE-01" }, { "PERCHASE02", "PERCHASE-02" }, }; // 課金ID→内部ID にしたのを保存 setRecord(tbl.at(id)); }
// 課金成功時に記録を保存する void purchased(std::string id) { // 課金ID→内部ID std::map<std::string, std::string>
tbl{ { "PERCHASE01", "PERCHASE-01" }, { "PERCHASE02", "PERCHASE-02" }, }; // 無効な課金IDだとここでアプリが落ちる setRecord(tbl.at(id)); }
ͬ͞͞ͱमਖ਼ // 課金成功時に記録を保存する void purchased(std::string id) { // 課金ID→内部ID std::map<std::string,
std::string> tbl{ { "PERCHASE01", "PERCHASE-01" }, { "PERCHASE02", "PERCHASE-02" }, }; // 無効なIDでなければ処理する if (tbl.count(id)) { setRecord(tbl.at(id)); } }
ͬͦͯ͘͞͠όʔδϣϯΞοϓ ਃʂ
ʮͬͺΓىಈ͠·ͤΜɻʯ
;ͨͨͼιʔείʔυΛಡΉ
͓ʁ // 課金情報を取得 void price(NSString* product_id, id<SKProductsRequestDelegate> viewController) { NSSet<NSString*>*
id_set = [NSSet setWithObject:product_id]; // リクエストを生成 SKProductsRequest* request = [[[SKProductsRequest alloc] initWithProductIdentifiers:id_set] autorelease]; request.delegate = viewController; // 取得開始! [request start]; }
উखʹղ์ͨ͠Βμϝͳͭʜʁ // 課金情報を取得 void price(NSString* product_id, id<SKProductsRequestDelegate> viewController) { NSSet<NSString*>*
id_set = [NSSet setWithObject:product_id]; // リクエストを生成 SKProductsRequest* request = [[[SKProductsRequest alloc] initWithProductIdentifiers:id_set] autorelease]; request.delegate = viewController; // 取得開始! [request start]; }
ͬͦͯ͘͞͠όʔδϣϯΞοϓ ਃʂ
ʮͬͺΓىಈ͠·ͤΜɻʯ
·ͨιʔείʔυΛಡΉͱ͜Ζ͔ Β͔ʜ
ͱʜ͜͜ͰϢʔβʔ͔Βͷوॏͳ ใ͕ʂ
ใ̍ʮ՝ۚ࣌ʹΫϨδοτΧʔ υ൪߸Λొͨ͠ʯ
wϢʔβʔ͕ॳΊͯ՝ۚͨ࣌͠ͷڍಈ wΞϓϦ͔Β"QQ4UPSFը໘ભҠͯ͠ɺ·ͨΞϓ Ϧʹͬͯ͘Δύλʔϯ
ใ̎ʮΫϥογϡϩάʹͦΕΒ ͖͠ใ͕ʂʯ
None
͜Ε͔ʂ // 課金成功時の処理 void provideContent(NSString* productIdentifier) { // IDをNSString→std::stringにして課金完了処理へ purchase_completed([productIdentifier
UTF8String]); } // 課金完了処理 void purchase_completed(std::string& id) { // 色々処理 }
// 課金成功時の処理 void provideContent(NSString* productIdentifier) { // 変換結果が null の場合があり得る
purchase_completed([productIdentifier UTF8String]); } // 課金完了処理 void purchase_completed(std::string& id) { // idが null の場合にアプリが落ちる }
͜͏ͨ͠ // 課金成功時の処理 - (void)provideContent:(NSString *)productIdentifier { std::string id =
productIdentifier ? [productIdentifier UTF8String] : ""; ngs::purchase_completed(id); } // 課金完了処理 void purchase_completed(std::string& id) { // idがnullになることはない }
ʮىಈ͠·ͨ͠ʂ͋Γ͕ͱ͏͟͝ ͍·͢ʂʂʂʂʯ
̎ϲֻ݄͚ͯղܾʂ
wखݩͰ࠶ݱͰ͖ͳ͍ෆ۩߹ͷղܾ͍͠ wϢʔβʔ͔Βͷࠣ͘͝ࡉͳใࠂݟಀ͞ͳ͍ w͖͋ΒΊͳ͍ؾ࣋ͪ ·ͱΊ
w5XJUUFS!NJOHBNF w'BDFCPPLNJOHBNF w(JU)VCUFLOJTIJ wΞϓϦͷιʔείʔυIUUQTHJUIVCDPN UFLOJTIJ1V[[MF"OE.POBSDI ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ