我一直在搜索stackoverflow几天如何让产品从itunes connect返回。我发现了很多信息,并试图遵循它。但是,我无法在SKProductsResponse中获得任何产品返回。
我正在使用Xcode 6.1.1
我尝试删除并重新添加产品。
我用模拟器和我的iPhone 5试过这个
我等了24小时,看看是否会导致产品出现。没有。
以下是我每次都遵循的流程:
ViewController.m:
//
// ViewController.m
// iaptest01
//
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
activityIndicatorView = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:
UIActivityIndicatorViewStyleWhiteLarge];
activityIndicatorView.center = self.view.center;
[activityIndicatorView hidesWhenStopped];
[self.view addSubview:activityIndicatorView];
[activityIndicatorView startAnimating];
[self fetchAvailableProducts];
}
-(void)fetchAvailableProducts{
NSSet *productIdentifiers = [NSSet
setWithObjects:@"com.ftotech.iaptest01.product1",
nil];
productsRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];
}
-(void)productsRequest:(SKProductsRequest *)request
didReceiveResponse:(SKProductsResponse *)response
{
SKProduct *validProduct = nil;
int count = (int)[response.products count];
[_labelProduct setText:response.description];
if ( count > 0 ) {
validProducts = response.products;
validProduct = [response.products objectAtIndex:0];
[_labelProduct setText:[NSString stringWithFormat:
@"found product: %@",validProduct.localizedTitle]];
UIAlertView *tmp = [[UIAlertView alloc]
initWithTitle:@"Available"
message:@"Found products"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Ok", nil];
[tmp show];
} else {
UIAlertView *tmp = [[UIAlertView alloc]
initWithTitle:@"Not Available"
message:[@"No products: " stringByAppendingString:
[NSString stringWithFormat:@"%d", count]]
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Ok", nil];
[tmp show];
}
NSArray *products = response.invalidProductIdentifiers;
for (SKProduct *product in products)
{
NSLog(@"Product not found: %@", product);
}
[activityIndicatorView stopAnimating];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
ViewController.h:
//
// ViewController.h
// iaptest01
//
//
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
@interface ViewController : UIViewController<SKProductsRequestDelegate>
{
SKProductsRequest *productsRequest;
NSArray *validProducts;
UIActivityIndicatorView *activityIndicatorView;
}
@property (weak, nonatomic) IBOutlet UILabel *labelProduct;
- (void)fetchAvailableProducts;
@end
任何人都可以看到我错过的一个步骤或我错误配置的内容吗?
谢谢!
答案 0 :(得分:0)
问题是我的银行和税务信息不完整
为了使上述流程有效,请转到&#34;协议,税务和银行&#34; iTunes中的区域连接并验证&#34; iOS付费应用程序&#34;合同生效。
完成信息后大约需要15分钟,但是一旦合同生效,SKProductsResponse就会正确退回产品。
谢谢Matt Gibson的提示,让我开始寻求解决方案!
顺便说一句,它可以在iOS模拟器8.1中运行。