terminating due to uncaught exception

Discussion in 'Mac Programming' started by andyiapan, Nov 26, 2010.

  1. andyiapan, Nov 26, 2010
    Last edited by a moderator: Dec 2, 2010

    macrumors newbie

    Joined:
    Feb 28, 2010
    #1
    Code:
    NSArray *db1;
    
    
    .....
    
    - (void)viewDidLoad
    {
    ....
    
    db1 = [newStr componentsSeparatedByString:@"	"];
    
    
    }
    - (IBAction) button1:(id)sender{
    	
    	queue1.titleLabel.text = [db1 objectAtIndex: 3];
    
    }
    
    just a simple call, why terminate, HELP thanks><
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Read the Memory Management Guide. All of it. If you don't understand something stop until you do.

    You are assigning an autoreleased value to db1 so you cannot expect that to exist at some undefined point in the future.
     
  3. thread starter macrumors newbie

    Joined:
    Feb 28, 2010
    #3
    Thanks, assigning an autoreleased value? i still can't find out reason,
    can explain to me><

    Many Thanksss

     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    That is the reason. If you don't know what that means you need to go back to basics. Did you read the document I linked to? Have you read the Objective-C guide on the developer site? If you don't know what that means you don't have the most basic knowledge you need.
     

Share This Page