我在我的应用程序中实现了应用程序购买。我在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设置为是,但仍然没有对exc_bad_access进行解释。
如果有人能给出答案,我会很高兴。提前谢谢。
发布于 2011-01-03 21:42:22
您忘了在NSLog格式字符串之前放一个@符号:
NSLog(@"%@",subscriptionProduct.localizedTitle); /***EXC_BAD_ACCESS** */https://stackoverflow.com/questions/4584811
复制相似问题