Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SKProductsRequest - No Response Now (was working - same code)

Code as following - this code worked yesterday are providing invalid ID's now longer works, i've been though code about 10 times

.m

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

@interface InAppViewController : UIViewController  <SKProductsRequestDelegate, SKPaymentTransactionObserver> {

    SKProduct *proUpgradeProduct;
    SKProductsRequest *productsRequest;
}

.h

#import "InAppViewController.h"


@implementation InAppViewController

- (void)viewDidLoad{
    [self requestProUpgradeProductData];
}

- (void)dealloc {
    [super dealloc];
}

- (void)requestProUpgradeProductData
{
    NSLog(@"called  productsRequest");

    NSSet *productIdentifiers = [NSSet setWithObject:@"com.okz8.investor.gem15" ];
    productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
    productsRequest.delegate = self;
    [productsRequest start];

    // we will release the request object in the delegate callback
}

#pragma mark -
#pragma mark SKProductsRequestDelegate methods

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    NSArray *products = response.products;
    proUpgradeProduct = [products count] == 1 ? [[products firstObject] retain] : nil;
    if (proUpgradeProduct)
    {
        NSLog(@"Product title: %@" , proUpgradeProduct.localizedTitle);
        NSLog(@"Product description: %@" , proUpgradeProduct.localizedDescription);
        NSLog(@"Product price: %@" , proUpgradeProduct.price);
        NSLog(@"Product id: %@" , proUpgradeProduct.productIdentifier);
    }

    for (NSString *invalidProductId in response.invalidProductIdentifiers)
    {
        NSLog(@"Invalid product id: %@" , invalidProductId);
    }

    // finally release the reqest we alloc/init’ed in requestProUpgradeProductData
    [productsRequest release];

    //[[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil];
}

This just does not return response i've done all here http://troybrant.net/blog/2010/01/invalid-product-ids/

Was getting invalid ID's now i dont get anything

like image 933
okett Avatar asked Oct 17 '25 13:10

okett


2 Answers

Had the same problem and found the solution here: productsRequest response method is not calling

Due to automatic reference counting my request was immediately deleted again...

like image 185
user178379 Avatar answered Oct 19 '25 13:10

user178379


Based on user178379 response, Try to implement this method:

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
    NSLog(@"request - didFailWithError: %@", [[error userInfo] objectForKey:@"NSLocalizedDescription"]);
}

My problem was: Cannot connect to iTunes Store, which was for:

StoreKit (In-App purchases) will not work in the Simulator. 13962338
like image 39
Roozbeh Zabihollahi Avatar answered Oct 19 '25 14:10

Roozbeh Zabihollahi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!