gpt4 book ai didi

iphone - 错误域=SKErrorDomain 代码=3 "Cannot connect to iTunes Store"UserInfo=0x1aaf40 {NSLocalizedDescription=无法连接到 iTunes Store}

转载 作者:行者123 更新时间:2023-11-28 20:41:03 25 4
gpt4 key购买 nike

目前我正在开发应用内购买功能,但我遇到了以下错误

“错误域=SKErrorDomain 代码=3“无法连接到 iTunes Store”UserInfo=0x1aaf40 {NSLocalizedDescription=无法连接到 iTunes Store}”

这是步骤。

1) 首先,我创建了一个应用程序“inAppPro”,它位于(状态)下:“准备上传”

enter image description here

2) 我添加了 4 种非消耗品。并填写相关信息。

enter image description here enter image description here

3) 我还为测试应用内购买产品创建了测试用户(沙盒)。

4) 我还创建了启用 inApp 购买的配置文件。

5) 我还创建了不带 (*) 通配符的 APP ID。

这是我目前正在使用的代码。

- (void)viewDidLoad
{
Detail1 *observer = [[Detail1 alloc] init];

[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}


- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{

if ([SKPaymentQueue canMakePayments])
{
NSString *product = [NSString stringWithFormat:@"com.companyname.inAppDemo.module%d",ApplicationDelegate.objectID];
NSLog(@"In-App product for request = %@", product);

SKPayment *payment = [SKPayment paymentWithProductIdentifier:product];
[[SKPaymentQueue defaultQueue] addPayment:payment];


}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MyApp" message:@"You are not authorized to purchase from AppStore"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction *transaction in transactions)
{
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased:

[self completeTransaction:transaction];

break;

case SKPaymentTransactionStateFailed:

[self failedTransaction:transaction];

break;

case SKPaymentTransactionStateRestored:

[self restoreTransaction:transaction];

default:

break;
}
}
}
- (void) failedTransaction: (SKPaymentTransaction *)transaction
{
if (transaction.error.code != SKErrorPaymentCancelled)
{
// Optionally, display an error here.
NSLog(@"%@",transaction.error);

}
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}

- (void) completeTransaction: (SKPaymentTransaction *)transaction
{
//[[MKStoreManager sharedManager] provideContent: transaction.payment.productIdentifier];
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}

- (void) restoreTransaction: (SKPaymentTransaction *)transaction
{
//[[MKStoreManager sharedManager] provideContent: transaction.originalTransaction.payment.productIdentifier];
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}
-(IBAction)btnpurchase:(id)sender
{
NSLog(@"ProductStatus = %@", ApplicationDelegate.productStatus);

if ([ApplicationDelegate.productStatus isEqualToString:@"FREE"])
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"This is free for you so ENJOY it!!!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil];
[alert show];
[alert release];
}
else if ([ApplicationDelegate.productStatus isEqualToString:@"PAID"])
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"You have already purchase it!!!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil];
[alert show];
[alert release];
}
else
{
NSLog(@"Detail1 id for product = %d", ApplicationDelegate.objectID);
NSString *product = [NSString stringWithFormat:@"com.companyname.inAppDemo.module%d",ApplicationDelegate.objectID];
NSLog(@"In-App product-id = %@", product);



SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObjects:product,nil]];
request.delegate = self;
[request start];

}
}

请任何人帮助我。

提前致谢。

最佳答案

您必须在“契约(Contract)、税务和银行业务”部分拥有有效的契约(Contract)。当然,请确保您使用了正确的配置文件,并且您已在 App Purchase 中为该 ID 启用,并且(最后)您已在 iTunes Connect 中添加了可购买的项目(如您的屏幕截图所示,您已这样做)。

关于iphone - 错误域=SKErrorDomain 代码=3 "Cannot connect to iTunes Store"UserInfo=0x1aaf40 {NSLocalizedDescription=无法连接到 iTunes Store},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8557735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com