0
 @interface ViewController
 {

 NSMutableArray * GetPrices;

 }

-(void)viewWillAppear:(BOOL)animated
 {
 GetPrices=[[NSMutableArray alloc]init];
  // here I’m adding objects to the array..
 }

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {

@try { if([Getprices count]>0) {

       //  dealing with array values
      }


}
@catch (NSException *exception) {


     // here Im using some mail service to get crash description
 }

 }

So I got following info to my mail

Stack Trace: -[__NSCFString count]: unrecognized selector sent to instance 0x157153180

stackoverflow.com/questions/5152651/… from this accepted answer Im thinking that array was released at some point.

Now my doubt is, Is there any chance of my array become released… (Let us say my app is in background for a long time, will my array gets released).

What are possible reasons for that crash ? Thank You..

siva krishna
  • 1,149
  • 2
  • 15
  • 23

1 Answers1

0

ARC will retain this array, so there is no way it becomes released until you do it programatically.

gvuksic
  • 2,983
  • 3
  • 32
  • 37
  • What will happen if ARC is Disabled ? – siva krishna Mar 04 '16 at 07:37
  • if you disable ARC for whole project than you have to write retains and releases manually, e.g. [GetPrices retain] and [GetPrices release]... – gvuksic Mar 04 '16 at 07:38
  • It's got nothing to do with ARC. Using `[[alloc] init]` will retain the object in both ARC and non-ARC worlds. – trojanfoe Mar 04 '16 at 07:39
  • @trojanfoe Actually I ket a try catch block in didselectrow method and in the catch block I'm using some mail service to know the reason of crash.. Now in mail i got some thing like "Stack Trace: -[__NSCFString count]: unrecognized selector sent to instance 0x157153180 " – siva krishna Mar 04 '16 at 09:16
  • http://stackoverflow.com/questions/5152651/what-does-the-unrecognized-selector-sent-to-instance-error-mean from this accepted answer i felt that my array was released at some point – siva krishna Mar 04 '16 at 09:22
  • What are the possible reasons for that exception ? – siva krishna Mar 04 '16 at 09:22
  • Use the debugger to set a watchpoint on writes to that variable in order to find out where it's happening,. – trojanfoe Mar 04 '16 at 10:19
  • @sivakrishna it is really hard to tell what is going on, please edit answer correctly and add code if you want someone to help you, I have no idea where is that count, how you populate array, what else you do in code... – gvuksic Mar 04 '16 at 10:41