iOS應(yīng)用內(nèi)置付費(fèi) IAP設(shè)置總結(jié)
wjforstudy分享了IAP的一些基本知識(shí)。
1.在開(kāi)始IAP開(kāi)發(fā)前,先要對(duì)IAP有個(gè)大概的了解,下面這片文章就是給你預(yù)備的:
蘋(píng)果的官方文檔:Store Kit Guide(In App Purchase)
現(xiàn)在網(wǎng)上已經(jīng)有對(duì)這個(gè)文檔很成熟的翻譯了,如果想加快閱讀速度,看這里
翻譯版本:http://yarin.blog.51cto.com/1130898/549141
PS:開(kāi)始IAP開(kāi)發(fā)并不需要多深的背景知識(shí),這里囫圇看下去就可以了。但是要了解IAP的兩種驗(yàn)證形式: 設(shè)備驗(yàn)證和服務(wù)器驗(yàn)證。
2.網(wǎng)上流傳比較廣的IAP開(kāi)發(fā)流程的帖子,講的范圍很全面,但是有的內(nèi)容跟不上時(shí)代了,一共有兩點(diǎn)需要注意:
一、在現(xiàn)在的IAP測(cè)試中,已經(jīng)不需要提交程序再讓開(kāi)發(fā)者把程序狀態(tài)設(shè)置“Developer Reject”了,只需要程序 到”prepare for upload“就可以了。
二、在IOS5,已經(jīng)可以在模擬器中測(cè)試,調(diào)試IAP這個(gè)功能了。
這一篇文章地址是:
IAP(程序內(nèi)購(gòu)買(mǎi)): 完全攻略
http://fei263.blog.163.com/blog/static/927937242011321105241823/
這篇文章包含了從創(chuàng)建APP ID 開(kāi)始到IAP基本功能實(shí)現(xiàn)的整個(gè)流程,很全面,值得花時(shí)間去看一看,但是注意幾個(gè)問(wèn)題:
1.文中有幾個(gè)前置條件沒(méi)有說(shuō)明:
<1 在添加Test User之前,應(yīng)該已經(jīng)設(shè)置好ITunes Connect賬戶(hù)中關(guān)于Purchase Contract的信息。至少應(yīng)該點(diǎn)擊contract 的request按鈕,讓contract置于pending in process的狀態(tài)。
完成上面的操作后,你才會(huì)在剛進(jìn)入Manage User界面的時(shí)候,能選擇創(chuàng)建Test User。
3.請(qǐng)保證這個(gè)時(shí)候你的pruchase contract已經(jīng)完成了!contract中的 bank info,tax info,contact info都需要填寫(xiě)完成!
這篇帖子是這里要推薦的,主要介紹了Itunes Connect中創(chuàng)建了程序信息后,IAP的準(zhǔn)備和測(cè)試的過(guò)程:
【iOS開(kāi)發(fā)必收藏】詳解iOS應(yīng)用程序內(nèi)使用IAP/StoreKit付費(fèi)、沙盒(SandBox)測(cè)試、創(chuàng)建測(cè)試賬號(hào)流程!
http://blog.csdn.net/xiaominghimi/article/details/6937097
4.遇到問(wèn)題了?
好了,經(jīng)過(guò)前面的準(zhǔn)備后,就到了真正和IAP聯(lián)通的步驟了。在輸入一個(gè)Product ID向服務(wù)器發(fā)起request的時(shí)候,很有可能出現(xiàn)失敗的情況,在request屬性InvalidateIdentifier中,你會(huì)發(fā)現(xiàn)這個(gè)Product ID是無(wú)效的。
為什么呢?蘋(píng)果是不會(huì)告訴你的,連個(gè)錯(cuò)誤代碼都沒(méi)有,非??拥?。
所以這里我們有一個(gè)Check List,需要大家逐條檢查:
Have you enabled In-App Purchases for your App ID?
Have you checked Cleared for Sale for your product?
Have you submitted (and optionally rejected) your application binary?
Does your project’s .plist Bundle ID match your App ID?
Have you generated and installed a new provisioning profile for the new App ID?
Have you configured your project to code sign using this new provisioning profile?
Are you building for iPhone OS 3.0 or above?
Are you using the full product ID when when making an SKProductRequest?
Have you waited several hours since adding your product to iTunes Connect?
Are your bank details active on iTunes Connect? (via Mark)
Have you tried deleting the app from your device and reinstalling? (via Hector, S3B, Alex O, Joe, and Alberto)
Is your device jailbroken? If so, you need to revert the jailbreak for IAP to work. (via oh my god, Roman, and xfze)
If you answered “No” to any one of these questions, there’s your problem.
If you answered “Yes” for each of these questions and you still have an invalid product ID, then you have a problem I haven’t seen before. Check out the links in the next section, several of which are Developer Forum posts that were especially helpful in my hunt for debugging invalid product IDs.
5.再使用別人提供的例子代碼測(cè)試IAP完成以后,這里向你介紹一個(gè)別人封裝好的類(lèi)庫(kù):ECPurchase
http://mobile.51cto.com/hot-410074.htm 類(lèi)庫(kù)在附件中下載。