NSMutable array is not working for me

Discussion in 'iOS Programming' started by subhashmaxnet, Apr 7, 2010.

  1. subhashmaxnet macrumors newbie

    Joined:
    Apr 7, 2010
    #1
    hi,friends
    right now i am trying to store values which im returning from webservice.
    i amusing [arrayname addObject:eek:bject] method to add the objects to the array
    -(void)parser:(NSXMLParser *) parser foundCharacters:(NSString *)string
    {
    //NSMutableArray *number=[NSMutableArray arrayWithCapacity:6];
    [number addObject:mad:"a"];

    if (elementFound)
    {
    [soapResults appendString: string];

    [number addObject:string]; NSLog(@"added to array=%@",string);


    //NSLog(@"This code is executing=%@",string);

    }
    }

    -(IBAction)all:(id)sender
    {

    /*for(i=0;i<4;i++)
    {

    [number addObject:mad:"Hello"];

    }*/
    NSLog(@"Getting into");
    for(NSString *mystr in number)
    {

    NSLog(@"Name=%@",mystr);
    }

    }

    the code is adding only one i.e last element to the array i
    have also tried insertobject:eek:bj atindex method but it is giving me error that
    terminating due to uncaught exception err.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Use code tags. The above is an unreadable mess right now. If you want to see how they work quote this reply.
    Code:
    [codeTags use:YES];
    
     

Share This Page