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 t开发者_开发知识库hat 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.
You've forgotten to put an @ symbol before your NSLog format string:
NSLog(@"%@",subscriptionProduct.localizedTitle); /***EXC_BAD_ACCESS** */
精彩评论