开发者

In-App Purchase response.products empty

开发者 https://www.devze.com 2023-03-19 16:52 出处:网络
I know it has been asked before: iPhone In App Purchase - response.products are still empty? but I am also trying to implement an in app purchase and my response.products is empty.

I know it has been asked before: iPhone In App Purchase - response.products are still empty?

but I am also trying to implement an in app purchase and my response.products is empty. My situation:

I uploaded and rejected my binary once.

But then I put the status back to waiting for upload again.(Does it matter?)

The status of all my in app purchase products are "Ready to Submit".

My production user is signed out. Test user not signed in yet.

-(void) requestProductData{
    SKProductsRequest *productRequest= [[SKProductsRequest alloc] 
                                 initWithProductIdentifiers:[NSSet setWithObjects:
                                                             @"com.mydomain.myapp.Pack1", 
                                                             @"com.mydomain.myapp.Pack2",
                                                             @"com.mydomain.myapp.Pack3",nil]];

productRequest.delegate = self;
[productRequest start];
}

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

NSArray *myProducts = response.products; 

NSLo开发者_运维知识库g(@"%d",[myProducts count]);//this prints 0
for(SKProduct * product in myProducts) {
    [products addObject:product];
}
[request autorelease]; 


}

    in my viewdidload:


if([SKPaymentQueue canMakePayments]) {
        NSLog(@"IN-APP:can make payments");
    }
    else {
        NSLog(@"IN-APP:can't make payments");
    }

    /*load transaction history to see if the user already bought some packs*/
    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    products = [[NSMutableArray alloc] init];
    NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0]; 
    NSString * path = [documentsDirectory stringByAppendingPathComponent: @"history.plist"];
    self.transactionHistory = [NSMutableArray arrayWithContentsOfFile: path];

    if(!transactionHistory) { 
        NSMutableArray *_transactionHistory = [[NSMutableArray alloc] init]; 
        self.transactionHistory = _transactionHistory;
        [_transactionHistory release];
    } 
    //some other initializations here
    [self requestProductData];

for (NSString *invalidProductId in response.invalidProductIdentifiers)
    {
        NSLog(@"Invalid product id: %@" , invalidProductId);
    }
//this returns 3 of my product id's


You have an invalid product error, so check your configuration with this topic: Invalid Product IDs

  • 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?
  • Have you tried deleting the app from your device and reinstalling?
  • Is your device jailbroken? If so, you need to revert the jailbreak for IAP to work.
0

精彩评论

暂无评论...
验证码 换一张
取 消