NSmutableArray에 NSString 이름을 추가하고 싶습니다. 그러나 그것에 대해 알지 못합니다. 나는 wamp 서버에 url로부터 5 개의 NSString 이름을 얻었고 NSMutableArray에이 이름들을 추가하고 싶다.NSMutableArray 루프에서 NSString을 추가하는 방법
이것은 내 코드이지만 작동하지 않습니다 !!! : 사전에 배열에 추가됩니다 요소의 수에 대해 확실하지 않은 경우 당신은 NSMutableArray
NSMutableArray *file = [[NSMutableArray alloc] initWithCapacity:5];
를 할당하지 않는
NSMutableArray *file;
for (int j=0; j < 5; j++) {
NSString *fileName = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://192.168.1.101/janatan/filemanager.php?dir=root&file=%d&name",j]]];
NSLog(@"%@",fileName);
[file addObject:fileName] //right???
}
alloc] init]; NSMutableArray. – Bonnie
같은 파일 이름을 5 번 추가 하시겠습니까? – jkk