ios - EXC_BAD_ACCESS error in block of code made in App Delegate -



ios - EXC_BAD_ACCESS error in block of code made in App Delegate -

i don't understand whats causing exc_bad_access - kern_invalid_address error in app.

when app starts up, appdelegate.m create phone call skproductrequest available iaps app. works sometime not others , i'm @ loss figure out why. code in appdelegate looks following:

[[myiaphelper sharedinstance] requestproductswithcompletionhandler:^(bool success, nsarray *products) { if (success) { (skproduct *prod in products) { // set pricing in db [price setpriceofproduct:prod.productidentifier withlocale:prod.pricelocale andamount:prod.price]; } } }];

the requestproducts... method simply:

- (void)requestproductswithcompletionhandler:(requestproductscompletionhandler)completionhandler { _completionhandler = [completionhandler copy]; _productsrequest = [[skproductsrequest alloc] initwithproductidentifiers:_productidentifiers]; _productsrequest.delegate = self; [_productsrequest start]; }

any help on much appreciated - if i've left out key info allow me know.

for dealing bad_access, should have @ reply in post : ios error terminating app due uncaught exception 'nsrangeexception range or index out of bounds'

see how add together "malloc_error_break" breakpoint. might help find out line causing bug.

in case, suspect myiaphelper instance, or _productsrequest has been deallocated. check this, should override "dealloc" method of myiaphelper :

-(void)dealloc{ nslog(@"myiaphelper deallocated"); }

and add together breakpoint on nslog see if dealloc called.

you should check _productsrequest property retained (i.e. declared : @property(nonatomic,retain) skproductsrequest* productsrequest;

ios objective-c exc-bad-access

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -