没有调用StoreKit委托函数 [英] StoreKit delegate functions are not getting called

查看:63
本文介绍了没有调用StoreKit委托函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要你们的帮助.我已经在iPhone/iPad应用程序中实现了storekit代码,并且正在使用iOS 3.2在iPad 1上测试该应用程序.

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.

在执行所有步骤(例如在iTunes connect中为应用程序添加产品并使用预配置文件在iPad上运行该应用程序)之后,我尝试测试该应用程序,但是当我运行应用程序时,Storekit委托函数永远不会被调用给出任何错误,它永远不会崩溃.我不知道是什么问题.

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.

下面是我使用的代码

- (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");
}

我调用了requestProductData,但是没有调用任何委托函数.

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

非常感谢!

推荐答案

我认为这有点晚了,您现在就可以解决了,但是我正在尝试解决另一个问题,遇到了您的问题,想知道是否您的接口文件中有代表.

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

我怀疑您确实具有上述代码并按上述说明解决了该问题,但以防万一其他人遇到相同的问题并且忘记将委托包含在h文件中.

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.

这篇关于没有调用StoreKit委托函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆