- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *error;
json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
NSLog(@"json.... %@",json);
id jsonObject = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:nil];
NSLog(@"jsonObject=%@", jsonObject);
NSDictionary *checkArray=[json valueForKey:@"ND"];
NSArray *tel = [checkArray valueForKey:@"FN"];
testArray = [[NSMutableArray alloc]init];
testArray1 = [[NSMutableArray alloc]init];
newsarray = [[NSMutableArray alloc]init];
for (id photo in tel)
{
if (photo == [NSNull null])
{
NSString *test8;
test8 = @"empty";
[testArray addObject:test8];
}
else
{
// photo isn't null. It's an array
NSArray *innerPhotos = photo;
[testArray addObject:photo];
}
}
NSArray *tel1 = [checkArray valueForKey:@"LN"];
for (id photo1 in tel1)
{
if (photo1 == [NSNull null])
{
NSString *test8;
test8 = @"empty";
[testArray1 addObject:test8];
}
else
{
// photo isn't null. It's an array
//NSArray *innerPhotos1 = photo1;
[testArray1 addObject:photo1];
}
}
newsarray = [NSMutableArray arrayWithArray:[testArray arrayByAddingObjectsFromArray:testArray1]];
NSLog(@"testArray =%@",newsarray);
在這裏,我想兩個數組值相結合 「testArray」 和 「testArray1」如何在單個可變數組中組合兩個可變數組值?
我mutablearray值
testArray = AA,BB,CC,DD ... testArray1 = XX,YY ,ZZ,SS ...
我想我期待像輸出
AA XX,YY的BB,CC ZZ,DD SS
這行代碼是什麼意思: - [[testArray1 objectAtIndex:i]];' –
read complete line NSString * tmpObject = [NSString stringWithFormat:@「%@%@」,[testArray objectAtIndex:i], [testArray1 objectAtIndex :一世]]; – BhushanVU
喔ok了我的mistak,但我不認爲它neead一個創建newArray他們首先在添加到第二陣列就是這樣 –