【问题标题】:Strange behavior with inApp purchases应用内购买的奇怪行为
【发布时间】:2012-01-18 12:54:34
【问题描述】:

我最近遇到了一个很奇怪的问题。我有一个代码可以在我的应用中处理应用内购买。我一个月没有更改代码中的任何内容,这周我在调用以下方法时崩溃了:

//
// call this before making a purchase
//
- (BOOL)canMakePurchases
{return [SKPaymentQueue canMakePayments];
}

我尝试在 gdb 中执行 bt 命令并得到以下结果:

#0  0x33adffdc in CFRetain ()
#1  0x31f5bdb6 in ___init_block_invoke_2 ()
#2  0x36e797ea in _dispatch_barrier_sync_f_invoke ()
#3  0x36e7965a in dispatch_barrier_sync_f$VARIANT$up ()
#4  0x36e7928e in dispatch_sync_f$VARIANT$up ()
#5  0x36e79910 in dispatch_sync$VARIANT$up ()
#6  0x36e7b576 in dispatch_once_f$VARIANT$up ()
#7  0x31f5c706 in CPLoggingAddCustomLogFile ()
#8  0x320a2658 in __MCLoggingInitialize_block_invoke_1 ()
#9  0x36e7b576 in dispatch_once_f$VARIANT$up ()
#10 0x320a26a4 in MCLoggingInitialize ()
#11 0x320a3060 in -[MCProfileConnection _init] ()
#12 0x320a3764 in +[MCProfileConnection sharedConnection] ()
#13 0x31750764 in +[SKPaymentQueue canMakePayments] ()
#14 0x00037702 in -[InAppPay canMakePurchases] (self=0x44b1a0, _cmd=0x149c1e) at    /Users/lowfreq/Desktop/Projects/magazinereader/Archive/InAppPay.m:32
#15 0x00039444 in -[PreViewArchives Tap:] (self=0x46aba0, _cmd=0x149d03, sender=0x46f030) at /Users/lowfreq/Desktop/Projects/magazinereader/Archive/PreViewArchives.m:161
#16 0x33af1434 in -[NSObject performSelector:withObject:withObject:] ()
#17 0x34c1f9ea in -[UIApplication sendAction:to:from:forEvent:] ()
#18 0x34c1f9a6 in -[UIApplication sendAction:toTarget:fromSender:forEvent:] ()
#19 0x34c1f984 in -[UIControl sendAction:to:forEvent:] ()
#20 0x34c1f6f4 in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#21 0x34c2002c in -[UIControl touchesEnded:withEvent:] ()
#22 0x34c1e50e in -[UIWindow _sendTouchesForEvent:] ()
#23 0x34c1df00 in -[UIWindow sendEvent:] ()
#24 0x34c044ec in -[UIApplication sendEvent:] ()
#25 0x34c03d2c in _UIApplicationHandleEvent ()
#26 0x3572edf2 in PurpleEventCallback ()
#27 0x33b6b552 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#28 0x33b6b4f4 in __CFRunLoopDoSource1 ()
#29 0x33b6a342 in __CFRunLoopRun ()
#30 0x33aed4dc in CFRunLoopRunSpecific ()
#31 0x33aed3a4 in CFRunLoopRunInMode ()
#32 0x3572dfcc in GSEventRunModal ()
#33 0x34c32742 in UIApplicationMain ()
#34 0x00002364 in main (argc=1, argv=0x2fdffb38) at /Users/lowfreq/Desktop/Projects/magazinereader/main.m:14
Current language:  auto; currently objective-c

发生了什么事?我不明白为什么工作了一个月没有任何问题的代码现在让我崩溃了? 我试图从头开始重建配置文件,重置我的 iPad,但仍然没有运气 提前感谢您提供任何线索!

【问题讨论】:

  • 好的,我知道是什么问题。该问题是由使用俄语字母编写的应用程序名称引起的。一旦我在应用程序名称中添加了第一个空格 - 问题就消失了。似乎是 SDK 本身的一个丑陋的错误。
  • 神秘,但它有效!谢谢)

标签: objective-c ios sdk crash in-app-purchase


【解决方案1】:

因为您正在尝试SKPaymentQueue canMakePayments,所以在设备和模拟器中都尝试..如果它在两者中都崩溃..那么它必须是代码错误..然后发布代码。

【讨论】:

  • 我到处都试过了......但一点运气都没有...... self.inAppPay = [[InAppPay alloc] init]; [[SKPaymentQueue defaultQueue] addTransactionObserver:self.inAppPay]; self.inAppPay.preViewArchives = 自我; if ([inAppPay canMakePurchases]== YES) { button.enabled = NO; NSLog(@"支付正确"); [self.inAppPay purchaseProUpgrade:idProducts]; }else {NSLog(@"PAY FAIL");}
  • 它在设备和模拟器上都崩溃了?
  • 是的。它在两者上都崩溃了!真正有趣的是它本身并没有崩溃。它只是永远卡在 canMakePayment 电话上
  • 尝试 BOOL temp =[SKPaymentQueue canMakePayments];然后Nslog它然后return..然后在函数中放置断点并检查它卡在哪里,
  • 我尝试将 canMakePayent 调用更改为仅返回 YES,但随后 - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions 方法返回未知 transaction.transactionState。它不是 SKPaymentTransaction.h 中定义的值之一
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多