Привет всем, я реализовал код, как показано ниже, и я получаю элементы NSMutableArray, как показано ниже, но когда я загружаю элементы массива в табличное представление, оно показывает
ContactTesting с сервером начальной загрузки. Ошибка: неизвестный код ошибки.
Как правило, это означает, что другой экземпляр этого процесса уже запущен или завис в отладчике. (GDB). так что дайте решение для добавления элементов NSMutableArray в таблицу в 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",
для этого я реализовал код tableView, как показано ниже, показывая
Не удалось зарегистрировать com.fitzgerald.-ContactTesting.ContactTesting с помощью сервера начальной загрузки. Ошибка: неизвестный код ошибки.
Обычно это означает, что другой экземпляр этого процесса уже запущен или завис в отладчике. (Gdb)
(аннулируются) viewDidLoad
{
myTableView.delegate = я;
myTableView.dataSource = самостоятельно;
myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
myTableView.backgroundColor = [[UIColor alloc] initWithPatternImage: [UIImage imageNamed: @ "list.png"]];
myTableView.scrollEnabled = ДА;
массив = [NSMutableArray alloc];
[super viewDidLoad];
[самотестирование];
// Выполнить любую дополнительную настройку после загрузки представления, обычно из кончика.
}
(NSInteger) numberOfSectionsInTableView: (UITableView *) tableView {
возврат 1;
}
- (NSInteger) tableView: (UITableView *) таблица numberOfRowsInSection: (NSInteger) раздел {
return [количество массивов];
}
- (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;
}
- (Недействительными) тестирование {
// 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];
}
}
- (недействительное) соединение: (NSURLConnection *) соединение didReceiveResponse: (NSURLResponse *) ответ
{
[RoutData setLength: 0];
}
- (недействительное) соединение: (NSURLConnection *) соединение didReceiveData: (NSData *) данные
{
[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
// для (int i = 0; i <[arrStation count]; i ++) {
// NSLog (@ "--- >>> ContactNameis: <<< ----% @", [[[[[arrStation objectAtIndex: i] objectForKey: @ "content"] objectForKey: @ "m: properties" ] objectForKey: @ "d: ContactName"] objectForKey: @ "text"]); </p>
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);
}