1

I have a problem I cannot solve and I'm stuck.

I've implemented an in-App purchase screen, The problem is that when I'm checking that on iOS3.1.3 it works perfectly also on iOS5 simulator, but when using iOS4 I dont get and products on the response,

The relevant code I'm using:

-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
if ([response.products count]==0) {

       // Always gets in here on iOS4....

}else{

   //get here on 3.1.3 or 5

    [productDetailsList addObjectsFromArray: response.products];
}

....

[request release];  
}

- (void)requestProductData {
for (short item_count = 1; item_count <=4 ; item_count++) {
    [productIdentifierList addObject:[NSString stringWithFormat:@"myApp.item.%d", item_count]];


}

SKProductsRequest *request = [[[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifierList]] retain];

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

the .h file looks like this:

#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>

@interface viewController : UIViewController
<SKProductsRequestDelegate, SKPaymentTransactionObserver> {

NSMutableArray *productIdentifierList;
NSMutableArray *productDetailsList;
NSMutableArray *transactionHistory;

}
@property (nonatomic, retain) NSMutableArray *productIdentifierList;
@property (nonatomic, retain) NSMutableArray *productDetailsList;
@property (nonatomic, retain) NSMutableArray *transactionHistory;

- (void)requestProductData;
- (void)completeTransaction: (SKPaymentTransaction *)transaction;
- (void)restoreTransaction: (SKPaymentTransaction *)transaction;
- (void)failedTransaction: (SKPaymentTransaction *)transaction;
- (void)recordTransaction: (SKPaymentTransaction *)transaction;
- (void)provideContent: (NSString *)productIdentifier;
@end

I've tried to make all provision from scratch and that didn't resolve the problem, Maybe that's something related to memory management but I cannot figure out what.

Weird it works on my 3.1.3 and not on 4.2.1.

Please help...

  • I also try to make a new provision profile, and in-App enabled. nothing works! Please try to help. – user1020875 Oct 31 '11 at 10:53
  • I think it might have something to do with the prev. version! I also had to install the prev. version of my program before installing the new one with the storekit. (Previous in this case means the version before the Storekit has been implemented) – NicTesla Nov 29 '11 at 20:34

1 Answers1

0

StoreKit API works on Device only in 4.2, so you must try to execute it in Device. while in 3.1 ios simulator version i not worked but in ios5 Simulator it is working i think it may be the bug of ios5 Simulator or they are trying to give new functionality. But in Apple's site they have mention that storekit will works only on Device.

So you just try the same b building your project on device.

  • This is not entirely true anymore. I'm able to get and purchase products from Apple on iOS 5.0 simulator, but not iOS 4. – Genki Apr 18 '12 at 17:44