StoreKit delegate functions are not getting called

∥☆過路亽.° 提交于 2020-01-07 05:35:10

问题


I wanted help from you guys. I have implemented the storekit code in my iPhone/iPad app and I am testing the application on iPad 1 with iOS 3.2.

I tried to test the application after performing all the steps like adding the products in for an application in iTunes connect and using provisioning profile to run that app on my iPad but when i run the application Storekit delegate functions are never called neither it gives any error and it never crashes. I can't figure out what is the problem.

Please help me to resolve this.

Below is the code which i have used

- (void) requestProductData
{

    SKProductsRequest *request= [[SKProductsRequest alloc]
    initWithProductIdentifiers: [NSSet setWithObject:@"myproductid"]];


    request.delegate = self;           
    [request start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:
(SKProductsResponse *)response
{
    NSArray *myProduct = response.products;
    // populate UI
    [request autorelease];
}

- (void) request:(SKRequest *)request didFailWithError:(NSError *)error {
    NSString *errorMessage = [error localizedDescription]; 
    NSLog(@"%@",errorMessage);
}

- (void)requestDidFinish:(SKRequest *)request{
    NSLog(@"%@",@"inside request finish");
}

I call the requestProductData but none of the delegate function is called.

Thanks so much in advance!


回答1:


I figure this is a bit late and you would of solved it by now, but I am trying to resolve another issue, came across your question and was wondering if you had the delegates in your interface file.

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

@interface ViewController : UIViewController<SKProductsRequestDelegate, SKRequestDelegate, SKPaymentTransactionObserver>

@end

I suspect you did have the above code and as said solve it, but just in case someone else has the same issue and has forgotten to include the delegates in the h file.



来源:https://stackoverflow.com/questions/7945229/storekit-delegate-functions-are-not-getting-called

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!