开发者

SKProduct attributes throw exc_bad_access

开发者 https://www.devze.com 2023-02-01 23:54 出处:网络
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 canno

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** */
0

精彩评论

暂无评论...
验证码 换一张
取 消