Ios7 IOS 7-应用内购买教程
我正在关注,我可以看到我在iTunesConnect IAP内容中发布的产品说明和标题。但是,当我单击Buy按钮时,我得到一个线程1:EXC\u BAD\u ACCESScode=1,address=0xc错误:Ios7 IOS 7-应用内购买教程,ios7,in-app-purchase,storekit,Ios7,In App Purchase,Storekit,我正在关注,我可以看到我在iTunesConnect IAP内容中发布的产品说明和标题。但是,当我单击Buy按钮时,我得到一个线程1:EXC\u BAD\u ACCESScode=1,address=0xc错误: - (IBAction)buyProduct:(id)sender { SKPayment *payment = [SKPayment paymentWithProduct:_product];//<-- This line course the error. [
- (IBAction)buyProduct:(id)sender {
SKPayment *payment = [SKPayment paymentWithProduct:_product];//<-- This line course the error.
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
从-voidproductsRequest,我得到
有时会出现一些随机的长期结果:
Product title: Length 11 (2 blocks, 1 used, block 0 is at 0)
11 0x165ae790 {
NSColor = "UIDeviceRGBColorSpace 0.838794 0.39337 1 1";
NSFont = "<UICTFont: 0x165ae010> font-family: \".HelveticaNeueInterface-M3\"; font-weight: normal; font-style: normal; font-size: 17.00pt";
NSParagraphStyle = "Alignment 1, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 4, Tabs (\n 28L,\n 56L,\n 84L,\n 112L,\n 140L,\n 168L,\n 196L,\n 224L,\n 252L,\n 280L,\n 308L,\n 336L\n), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor 0, HeaderLevel 0";
NSShadow = "NSShadow {0, -1} color = {(null)}";
}
你知道我该怎么解决这个问题吗 请用设置“\u product”变量的代码展开答案。此外,我认为,只要在崩溃之前检查一下它的值,你就能自己找到答案。可能“\u product”是零或类似的东西。@Alexandrpaly你是对的,每次我测试时,\u product都是不同的。检查一下我刚做的编辑。我发现有些地方不对劲,但我还是不能给你任何好的建议。尝试在两个方法中设置断点,并在-voidproductsRequest:SKProductsRequest*request DidReceiverResponse:SKProductsResponse*response中设置后检查_产品变量值:1;2在尝试在中使用它之前-IBActionbuyProduct:idsender。我所说的检查是指在调试器控制台中使用po_产品。是的,我希望,两个方法在同一个类中。@Alexandrplary我按照你说的做了,1是,2是[没有可用的Objective-C描述]。隐马尔可夫模型。。。这很奇怪。是的,这两种方法在同一个类中。请检查您的代码并找到您为_product赋值的每个地方。如果在SKProductsRequest收到响应之前您的按钮被禁用,那么_产品不可能还没有初始化,那么在这两种方法之间会有某种东西损坏您的_产品。
productsRequest: <SKProduct: 0x17e8e3f0>
Product title: #<CGRegion 0x17e8e3f0 empty>
Product title: Length 11 (2 blocks, 1 used, block 0 is at 0)
11 0x165ae790 {
NSColor = "UIDeviceRGBColorSpace 0.838794 0.39337 1 1";
NSFont = "<UICTFont: 0x165ae010> font-family: \".HelveticaNeueInterface-M3\"; font-weight: normal; font-style: normal; font-size: 17.00pt";
NSParagraphStyle = "Alignment 1, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 4, Tabs (\n 28L,\n 56L,\n 84L,\n 112L,\n 140L,\n 168L,\n 196L,\n 224L,\n 252L,\n 280L,\n 308L,\n 336L\n), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor 0, HeaderLevel 0";
NSShadow = "NSShadow {0, -1} color = {(null)}";
}