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...