iOS應用IAP設置總結

原文地址:http://www.cocoachina.com/newbie/basic/2012/0214/3976.html

wjforstudy分享了IAP的一些基本知識。在論壇的地址是:http://www.cocoachina.com/bbs/read.php?tid=92060 

 1.在開始IAP開發前,先要對IAP有個大概的瞭解,下面這片文章就是給你預備的:
  蘋果的官方文檔:Store Kit Guide(In App Purchase)
    現在網上已經有對這個文檔很成熟的翻譯了,如果想加快閱讀速度,看這裏
    翻譯版本:http://yarin.blog.51cto.com/1130898/549141

    PS:開始IAP開發並不需要多深的背景知識,這裏囫圇看下去就可以了。但是要了解IAP的兩種驗證形式: 設備驗證和服務器驗證


2.網上流傳比較廣的IAP開發流程的帖子,講的範圍很全面,但是有的內容跟不上時代了,一共有兩點需要注意:
  一、在現在的IAP測試中,已經不需要提交程序再讓開發者把程序狀態設置“Developer Reject”了,只需要程序      到”prepare for upload“就可以了。
二、在IOS5,已經可以在模擬器中測試,調試IAP這個功能了。
    這一篇文章地址是:
  IAP(程序內購買): 完全攻略 
    http://fei263.blog.163.com/blog/static/927937242011321105241823/
    這篇文章包含了從創建APP ID 開始到IAP基本功能實現的整個流程,很全面,值得花時間去看一看,但是注意幾個問題:
    1.文中有幾個前置條件沒有說明:
<1 在添加Test User之前,應該已經設置好ITunes Connect賬戶中關於Purchase Contract的信息。至少應該點擊contract 的request按鈕,讓contract置於pending in process的狀態。
     完成上面的操作後,你纔會在剛進入Manage User界面的時候,能選擇創建Test User。


3.請保證這個時候你的pruchase contract已經完成了!contract中的 bank info,tax info,contact info都需要填寫完成!
   這篇帖子是這裏要推薦的,主要介紹了Itunes Connect中創建了程序信息後,IAP的準備和測試的過程:
【iOS開發必收藏】詳解iOS應用程序內使用IAP/StoreKit付費、沙盒(SandBox)測試、創建測試賬號流程!
http://blog.csdn.net/xiaominghimi/article/details/6937097


4.遇到問題了?
好了,經過前面的準備後,就到了真正和IAP聯通的步驟了。在輸入一個Product ID向服務器發起request的時候,很有可能出現失敗的情況,在request屬性InvalidateIdentifier中,你會發現這個Product ID是無效的。
爲什麼呢?蘋果是不會告訴你的,連個錯誤代碼都沒有,非常坑爹。
所以這裏我們有一個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.再使用別人提供的例子代碼測試IAP完成以後,這裏向你介紹一個別人封裝好的類庫:ECPurchase
http://www.cocoachina.com/bbs/read.php?tid-38555.html
類庫在附件中下載


發佈了11 篇原創文章 · 獲贊 2 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章