Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
課金処理とたたかう.pdf
Search
Nobuyuki Nishiyama
June 18, 2019
Programming
930
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
540
ゲーム音楽が好きすぎて実機から録音したけど需要ありますか?
5mingame2
2
910
正規表現苦手なんです...
5mingame2
1
650
コントロールセンターとたたかう
5mingame2
2
2.4k
OpenGLを試すなら
5mingame2
0
700
Emacs meets Vim
5mingame2
1
800
タッチジェスチャーとたたかう
5mingame2
4
820
教えて!Xcode
5mingame2
4
1.9k
つかおう!滑らか移動
5mingame2
0
630
Other Decks in Programming
See All in Programming
Building an Out-of-Order CPU
latte72
1
790
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
260
XHTMLが残したもの
yosuke_furukawa
PRO
2
830
Jetpack Compose メカニズム
skydoves
0
450
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
130
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
450
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1k
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
540
The Rails Doctrine Decade
koic
2
170
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
730
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
360
速習iPhone Duo対応
yuukiw00w
1
660
Featured
See All Featured
How to make the Groovebox
asonas
2
2.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
530
Fireside Chat
paigeccino
43
4k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
The Curious Case for Waylosing
cassininazir
1
510
Ethics towards AI in product and experience design
skipperchong
2
380
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
What's in a price? How to price your products and services
michaelherold
247
13k
Technical Leadership for Architectural Decision Making
baasie
3
570
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 ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ