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
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
910
正規表現苦手なんです...
5mingame2
1
650
コントロールセンターとたたかう
5mingame2
2
2.4k
OpenGLを試すなら
5mingame2
0
700
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
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
500
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
110
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
240
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
140
「AI時代、配布するPythonコードをどう守るか: 難読化の実験と判断軸」 #PyconJP2026
pkshadeck
PRO
2
190
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
490
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
120
App Intentsのビルドプロセスを支える技術
kntkymt
0
250
新卒PdEのリアル
ryu1013
1
490
What We Talk About When We Talk About XP
m_seki
2
490
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
150
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
270
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
530
How to Think Like a Performance Engineer
csswizardry
28
2.8k
A designer walks into a library…
pauljervisheath
211
25k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
530
Typedesign – Prime Four
hannesfritz
42
3.2k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
WENDY [Excerpt]
tessaabrams
13
39k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
A Soul's Torment
seathinner
7
3.6k
Done Done
chrislema
186
16k
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 ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ