SKProduct 属性抛出 exc_bad_access
我正在我的应用程序中实现应用程序内购买。我在 itunes 上创建了一个产品,并在代码中成功创建了产品请求功能。产品退货。问题是我无法访问产品的任何属性(localizedTitle、价格等)。它总是抛出 exc_bad_access。这是我的代码:
NSMutableArray *myProduct = [[NSMutableArray alloc] init];
[myProduct addObjectsFromArray:response.products];
if(myProduct != nil && [myProduct count] > 0)
{
SKProduct *subscriptionProduct = [myProduct objectAtIndex:0];
if(subscriptionProduct != nil)
{
if(subscriptionProduct.localizedTitle != nil)
NSLog("%@",subscriptionProduct.localizedTitle); /***EXC_BAD_ACCESS** */
}
}
[request autorelease];
我将 NSZombieEnabled 设置为 YES,但仍然没有对 exc_bad_access 的解释。
如果有人有答案,我会很高兴。 提前致谢。
I'm implementing in app purchase in my app. I created a product at itunes and also product requesting functions in code successfully. the product returns. the problem is that i cannot access any of the attributes of the prouct (localizedTitle, price etc.). It allways throws exc_bad_access. here's my code:
NSMutableArray *myProduct = [[NSMutableArray alloc] init];
[myProduct addObjectsFromArray:response.products];
if(myProduct != nil && [myProduct count] > 0)
{
SKProduct *subscriptionProduct = [myProduct objectAtIndex:0];
if(subscriptionProduct != nil)
{
if(subscriptionProduct.localizedTitle != nil)
NSLog("%@",subscriptionProduct.localizedTitle); /***EXC_BAD_ACCESS** */
}
}
[request autorelease];
I set NSZombieEnabled YES, but still no explanation for exc_bad_access.
I'll be glad if someone has an answer.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您忘记在 NSLog 格式字符串之前添加 @ 符号:
You've forgotten to put an @ symbol before your NSLog format string: