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
890
1
Share
課金処理とたたかう.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
500
ゲーム音楽が好きすぎて実機から録音したけど需要ありますか?
5mingame2
2
850
正規表現苦手なんです...
5mingame2
1
620
コントロールセンターとたたかう
5mingame2
2
2.4k
OpenGLを試すなら
5mingame2
0
670
Emacs meets Vim
5mingame2
1
780
タッチジェスチャーとたたかう
5mingame2
4
790
教えて!Xcode
5mingame2
4
1.9k
つかおう!滑らか移動
5mingame2
0
610
Other Decks in Programming
See All in Programming
【26新卒研修】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
150
cloudnative conference 2026 flyle
azihsoyn
0
160
AWSはOSSをどのように 考えているのか?
akihisaikeda
0
110
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
340
tRPCの概要と少しだけパフォーマンス
misoton665
2
270
Programming with a DJ Controller — not vibe coding
m_seki
3
810
Spec-Driven Development with AI Agents (Workshop, May 2026)
antonarhipov
3
340
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.7k
Making the RBS Parser Faster
soutaro
0
680
AI Agent と正しく分析するための環境作り
yoshyum
0
120
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The agentic SEO stack - context over prompts
schlessera
0
770
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.4k
Context Engineering - Making Every Token Count
addyosmani
9
870
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
240
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
150
Claude Code のすすめ
schroneko
67
220k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
350
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
160
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
140
The Cult of Friendly URLs
andyhume
79
6.9k
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 ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ