2012-08-11 112 views
0

我有應用內購買的問題。在向服務器發送請求後,沒有由SKProductsRequest返回的產品。IAP問題 - 沒有產品響應。產品陣列

我發送類似這樣的要求:

NSMutableSet *identificators = [[NSMutableSet alloc] init]; 
    [identificators addObject:kInAppPurchaseOneWeekIdentifier]; 
    [identificators addObject:kInAppPurchaseOneMonthIdentifier]; 
    [identificators addObject:kInAppPurchaseSixMonthsIdentifier]; 

    SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:identificators]; 
    request.delegate = self; 
    [request start]; 

    [identificators release]; 

在Consts.h我有那些

// In App Purchase 
#define kInAppPurchaseOneWeekIdentifier    @"com.astroboxapp.iap.OneWeek" 
#define kInAppPurchaseOneMonthIdentifier    @"com.astroboxapp.iap.OneMonth" 
#define kInAppPurchaseSixMonthsIdentifier   @"com.astroboxapp.iap.SixMonths" 

在我的課,我實現

-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { 

    if ([response.products count] > 0) { 
    // i've do my stuff - show the IAP to the user 
    } else { 
    // here goes the error handling 
    } 

} 

在我的案例[response.products count]是空陣列/字典,所以我 拋出一個錯誤。

編輯:我做了什麼?

  1. 我創建了一個新的IAP的,並與我的應用程序相關聯,我已經改變了產品標識也和改變他們在我的Consts.h

  2. 我試圖從改變應用程序的版本以某種方式1.0到1.1幫助我改變這個版本的IAP。

  3. 仍然沒有在我的設備上工作,而在模擬器中有我的IAP的條目,但我可以測試 - 因爲StoreKit不允許從sumulator測試購買。

  4. 在我的設備上,我從商店退出。

+0

- (空)productsRequest:(SKProductsRequest *)請求didReceiveResponse:(SKProductsResponse *)響應返回您蘋果服務器的響應,您確定您的產品標識符與您在曲調中連接的響應相同。 – 2012-08-11 12:16:27

+0

你的意思是? :) – h4cky 2012-08-11 12:17:36

+0

問題是,您可以在iTunes連接中定義某些產品,以便客戶下載,還需要在您的應用程序中本地存儲Therese產品的標識符。當您在應用程序購買中請求可用時,會發送本地標識符到蘋果,並與您在iTunes連接中定義的相比較。 – 2012-08-11 12:20:27

回答

2

如果[響應invalidProductIdentifers]數組不爲空就意味着你的產品不提供T下載,所以這是正常的,產品的數量是empty.just檢查你有什麼迴應

+0

我會檢查它。謝謝 – h4cky 2012-08-11 12:35:19

+0

當我在設備上測試它說,所有3個IAP都是無效的。他們處於「等待審覈」狀態,並且與當前的應用版本相關聯。應用程序狀態爲「等待上傳」 – h4cky 2012-08-11 13:01:07

+0

好吧,我已閱讀官方的蘋果文件爲這種情況下,我發現了其他一些資源,所以一切似乎都沒問題。但是我不確定我1-2小時前的最後一次更改是否會生效。 – h4cky 2012-08-11 13:45:02