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
1
780
課金処理とたたかう.pdf
potatotips #62で発表したスライドです!
https://potatotips.connpass.com/event/129207/
Nobuyuki Nishiyama
June 18, 2019
Tweet
Share
More Decks by Nobuyuki Nishiyama
See All by Nobuyuki Nishiyama
C++ MIX #11 これどう読むの...?
5mingame2
0
360
ゲーム音楽が好きすぎて実機から録音したけど需要ありますか?
5mingame2
2
720
正規表現苦手なんです...
5mingame2
1
530
コントロールセンターとたたかう
5mingame2
2
2.2k
OpenGLを試すなら
5mingame2
0
580
Emacs meets Vim
5mingame2
1
700
タッチジェスチャーとたたかう
5mingame2
4
700
教えて!Xcode
5mingame2
4
1.6k
つかおう!滑らか移動
5mingame2
0
540
Other Decks in Programming
See All in Programming
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.8k
rails newと同時に型を書く
aki19035vc
6
730
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
0
120
PHPカンファレンス 2024|共創を加速するための若手の技術挑戦
weddingpark
0
140
カスタムエフェクトプラグインで Atom Craft をいい感じにする@ADX / ADX LE勉強会 vol.1
cox2
0
110
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
0
220
DMMオンラインサロンアプリのSwift化
hayatan
0
190
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
710
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
180
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
200
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
280
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
310
Featured
See All Featured
A Philosophy of Restraint
colly
203
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Done Done
chrislema
182
16k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.4k
Designing for humans not robots
tammielis
250
25k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
How to train your dragon (web standard)
notwaldorf
89
5.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
52k
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 ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ