0
votes

hi all i have implemented code like below and i am getting NSMutableArray items as shown in the below but when i am uploading the array items to the table view it showing ContactTesting with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.(gdb). so give the solution for upending NSMutableArray items to the tableview in iphone.

array=[[NSMutableArray alloc]init];
for (int i=0; i<[arrStation count]; i++){
        NSString *str=[[[[[arrStation objectAtIndex:i] objectForKey:@"content"]   objectForKey:@"m:properties"] objectForKey:@"d:ContactName"] objectForKey:@"text"];
        //  NSlog(@"name is : %@",str);
        //NSLog(@"name is->>>>>>> : %@",str);
        [array addObject:str];
        NSLog(@"name is->>>>>>> : %@",array);

}


2012-02-29 14:24:20.256 ContactTesting[564:f803] name is->>>>>>> : (
    "\n        Enrico Gaetani",
    "\n        J\U00e9r\U00f4me Tredan",
    "\n        Mike Tsalidis",
    "\n        Dana Sugarman",
    "\n        Necip Ozyucel",
    "\n        Goksel Topbas",
    "\n        Nizar Abdul-Baki",
    "\n        Johannes Kanis",
    "\n        Kara Westhusing",
    "\n        Andreas Erlacher",
    "\n        Rudy Van Hoe",
    "\n        Lars Nygaard",
    "\n        Juha Karppinen",
    "\n        Ronan Geraghty",
    "\n        Luca Venturelli",

for this i have implemented tableView code as shown in the below it showing

Couldn't register com.fitzgerald.-ContactTesting.ContactTesting with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.(gdb)

  • (void)viewDidLoad {

    myTableView.delegate=self; myTableView.dataSource=self; myTableView.separatorStyle= UITableViewCellSeparatorStyleNone;

    myTableView.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"list.png"]]; myTableView.scrollEnabled=YES; array=[NSMutableArray alloc];

    [super viewDidLoad];

    [self testing]; // Do any additional setup after loading the view, typically from a nib. }

  • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1;
    }

  • (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section { return [array count]; }

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

static NSString *CellIdentifier = @"Cell";
//here you check for PreCreated cell.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

//Fill the cells...  
cell.textLabel.text = [array objectAtIndex: indexPath.row];
//yourMutableArray is Array 
return cell;

}

-(void)testing{ // NSLog(@">>>>>>>>>>>>233333");

NSString *jobSearchUrlString = [NSString stringWithFormat:@"http://infra2appsmobile.cloudapp.net/Infra2Apps.svc/Contacts"];
//NSLog(@"url for new articles is = %@",jobSearchUrlString);
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:jobSearchUrlString]];   

NSURLConnection *theconnection =  [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (theconnection) {
    RoutData = [[NSMutableData alloc] init];
}

}

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {

[RoutData setLength: 0];

} -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [RoutData appendData:data];

NSString *thexml = [[NSString alloc] initWithData:RoutData encoding:NSUTF8StringEncoding];

NSDictionary *dictXML= [XMLReader dictionaryForXMLString:thexml error:nil];

NSMutableArray *arrStation = [[dictXML objectForKey:@"feed"] objectForKey:@"entry"] ;//this would return the array of station dictionaries

// for (int i=0; i<[arrStation count]; i++) { // NSLog(@"--->>>ContactNameis:<<<---- %@",[[[[[arrStation objectAtIndex:i] objectForKey:@"content"] objectForKey:@"m:properties"] objectForKey:@"d:ContactName"] objectForKey:@"text"]);

    array=[[NSMutableArray alloc]init];
    for (int i=0; i<[arrStation count]; i++){
        NSString *str=[[[[[arrStation objectAtIndex:i] objectForKey:@"content"]   objectForKey:@"m:properties"] objectForKey:@"d:ContactName"] objectForKey:@"text"];
      //  NSlog(@"name is : %@",str);
        //NSLog(@"name is->>>>>>> : %@",str);
        [array addObject:str];
        NSLog(@"name is->>>>>>> : %@",array);

               }
1

1 Answers

1
votes

Try quitting and restarting the simulator , this usually solves the problem. If the problem still persists, refer this link... iPhone - strange error when testing on simulator