2012-06-14 116 views
3

我正在iOS SDK中的inapp購買工作,並且我完成了在iTunes中創建應用程序和非易耗品應用程序中的所有步驟在iTunes中管理inapp購買connect.my應用程序狀態是等待上傳像下面的屏幕截圖:如何在iTunes中測試我的inapp購買連接

enter image description here

和我inappurchase狀態準備提交

enter image description here

代碼明智的inapp-購買功能完成,但是,我測試我的應用程序是SKProductsRequest返回沒有找到任何產品...!

我主要的應用程序軟件包ID喜歡com.mycompany.myapp

和我的應用程序內包ID喜歡com.mycompany.paidapp

他們如何測試inapp購買步驟可以任何人指導我,請.. ..!

我的示例代碼是在這裏:

- (void)loadStore { 

    if ([SKPaymentQueue canMakePayments]) { 
     NSLog(@"Parental-controls are disabled"); 

     request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"com.mycompany.paidapp"]]; 
     //request.delegate = self; 
     [request setDelegate:self]; 
     [request start]; 


    } 
    else { 
     NSLog(@"Parental-controls are enabled"); 
    } 

} 

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

    SKProduct *validProduct = nil; 
    int count = [response.products count]; 
    if (count > 0) 
    { 
     validProduct = [response.products objectAtIndex:0]; 
     NSLog(@"Products found!"); 
     [[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:@"Product Found..!"]; 

    } else if (!validProduct) 
    { 
     NSLog(@"No products available"); 
     [[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:@"Product Not Found..!"]; 

    } 

} 

返回命令提示符總是在下面的NSLog輸出:

No products available

+0

com.mycompany.paidapp產品是否存在於應用內購買商店? –

+0

任何人都可以幫助我,請.... .... – Dinesh

+0

@Mitesh Khatri不存在應用商店...! – Dinesh

回答

2

測試應用程序內您可以創建一個AppID以及一些應用程序內容,在發佈應用程序之前,您應該檢查它。

因此,我遵循的政策如下: 1.首先上傳一個應用程序。 2.添加應用內容。 3.自己拒絕二進制文件。 一旦您確定了應用內測試,然後將新的二進制文件重新加載到iTunes。

希望這會有所幫助。

+0

感謝您的回答 – Dinesh

1

應用軟件包名稱和iTunes的應用程序包的名稱應該是相同的。並且產品必須存在於iTunes上。 試試下面的代碼:

[productIdentifierList addObject:@"CB001"]; 
[productIdentifierList addObject:@"CB002"]; 
[productIdentifierList addObject:@"CB003"]; 

     SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifierList]]; 
     request.delegate = self; 
     [request start]; 

CB001,CB002是你的iTunes您的產品ID。

它適用於我。

+0

我的應用內軟件包ID com。將mycompany.inapp替換爲像[productIdentifierList addObject:@「com。mycompany.inapp「];? – Dinesh

+0

編號其產品編號 –