产品ID无效:在IOS中购买应用

时间:2017-01-10 08:08:55

标签: ios xcode in-app-purchase itunes

您好我正面临着测试IAP功能的真正问题,有人可以告诉我如何解决这个问题

这是我的代码

-(IBAction)purchase:(id)sender{

SKProduct *skProduct = _products[0];
NSLog(@"Found product: %@ %@ %0.2f",
      skProduct.productIdentifier,
      skProduct.localizedTitle,
      skProduct.price.floatValue);

NSString *tempTitle = NSLocalizedString(@"InAppTitle", @"Message");
NSString *tempMessage = NSLocalizedString(@"InAppText", @"Message");
NSString *tempRestoreBtn = NSLocalizedString(@"Restore", @"Message");
NSString *tempPurchaseBtn = NSLocalizedString(@"Purchase", @"Message");
NSString *tempCancelBtn = NSLocalizedString(@"Cancel", @"Message");

NSString *temp = [NSString stringWithFormat:tempMessage,skProduct.localizedTitle,skProduct.price.floatValue];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:tempTitle message:temp delegate:self cancelButtonTitle:tempCancelBtn otherButtonTitles:tempRestoreBtn,tempPurchaseBtn, nil];
alert.tag = 456;
[alert show];

}

my static.h

#define AdmobBannerAdsID  @"ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxx"

#define AdmobFullScreenAdsID @"ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxx"

#define ProductIdentifiers @"com.7minute.workout.zerone.remove"

这是我在itunes Connect中的产品ID:

enter image description here

这是我的包标识符

enter image description here

调试区域

  

2017-01-10 07:24:52.823 7 MinuteWorkout [39958:433489]加载的产品清单......   2017-01-10 07:24:52.824 7 MinuteWorkout [39958:433489]产品ID无效:com.7minute.workout.zerone.remove   2017-01-10 07:24:57.440 7 MinuteWorkout [39958:433489] *由于未捕获的异常'NSRangeException'终止应用程序,原因:'* - [ NSArray0 objectAtIndex:]:index 0超出空NSArray的界限'   ***第一次抛出调用堆栈:   (       0 CoreFoundation 0x0000000105ecbd4b __exceptionPreprocess + 171       1 libobjc.A.dylib 0x000000010592821e objc_exception_throw + 48       2 CoreFoundation 0x0000000105ee37dd - [__ NSArray0 objectAtIndex:] + 93       3 7 MinuteWorkout 0x000000010226e4ff - [设置购买:] + 79       4 UIKit 0x00000001024c18bc - [UIApplication sendAction:to:from:forEvent:] + 83       5 UIKit 0x0000000102647c38 - [UIControl sendAction:to:forEvent:] + 67       6 UIKit 0x0000000102647f51 - [UIControl _sendActionsForEvents:withEvent:] + 444       7 UIKit 0x0000000102646e4d - [UIControl touchesEnded:withEvent:] + 668       8 UIKit 0x000000010252f545 - [UIWindow _sendTouchesForEvent:] + 2747       9 UIKit 0x0000000102530c33 - [UIWindow sendEvent:] + 4011       10 UIKit 0x00000001024dd9ab - [UIApplication sendEvent:] + 371       11 UIKit 0x0000000102cca72d __dispatchPreprocessedEventFromEventQueue + 3248       12 UIKit 0x0000000102cc3463 __handleEventQueue + 4879       13 CoreFoundation 0x0000000105e70761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17       14 CoreFoundation 0x0000000105e5598c __CFRunLoopDoSources0 + 556       15 CoreFoundation 0x0000000105e54e76 __CFRunLoopRun + 918       16 CoreFoundation 0x0000000105e54884 CFRunLoopRunSpecific + 420       17 GraphicsServices 0x0000000107e7fa6f GSEventRunModal + 161       18 UIKit 0x00000001024bfc68 UIApplicationMain + 159       19 7 MinuteWorkout 0x0000000102272a3f main + 111       20 libdyld.dylib 0x0000000109b1068d start + 1   )   libc ++ abi.dylib:以NSException类型的未捕获异常终止   (lldb)

0 个答案:

没有答案