带有值的NSArray在添加到父NSMutable Array

时间:2015-07-01 09:24:15

标签: objective-c arrays xcode xcode6

所以这是我的代码。

NSMutableArray *arrProductSet = [NSMutableArray array];
int countProducts = (int)dicTemp.count;
int countStart = 0;
while(countStart < countProducts) {
    NSMutableArray *arrProductInfo = [NSMutableArray array];
    NSArray *arrProductSpecs = [NSArray array];

    NSString *strObjectKey = [NSString stringWithFormat:@"%i",countStart];
    arrProductInfo = [dicTemp objectForKey:strObjectKey];

    arrProductSpecs = [self getProductSpecs:[arrProductInfo objectAtIndex:0]];

    NSLog(@"Specs %@",arrProductSpecs); //<= arrProductSpecs has value
    [arrProductInfo addObject:arrProductSpecs];

    NSLog(@"Product %@",arrProductInfo); //<= arrProductSpecs becomes empty
    [arrProductSet addObject:arrProductInfo];
    countStart++;
}

我无法在将arrProductSpecs添加到产品信息数组(arrProductInfo)时找出原因arrProductSet为空。

此外,如果我记录arrProductInfo,则最后arrProductSpecs数组的( ( 168, ACR33U, "ACR33U-A1 SmartDuo Smart Card Reader", 0, ( /* empty, but this have value, if logged */ ) ), ( 155, ACR3801, "ACR3801 Smart Card Reader", ( ( "Host Interface", "USB Full Speed" ), ( "Contact Smart Card Interface", "1 Full-sized smart card<br>&nbsp; &nbsp; &nbsp;ISO 7816 T=0 and T=1<br>&nbsp; &nbsp; &nbsp;Memory Cards" ), ( "Built-in Peripherals", "1 LED" ), ( "OS Supported", "Windows&nbsp;<br>Mac<br>Linux<br>Android" ), ( "Compliance / Certifications", "PC/SC, CCID, Microsoft &reg; WHQL, USB Full Speed<br>FIPS 201, TAA<br>CE, FCC, IEC/EN 60950, VCCI, RoHS 2, REACH" ), ( Applications, "e-Government<br>Banking & Payment<br>Access Control<br>Network Security<br>Public Key Infrastructure<br>e-Purse & Loyalty<br>" ) ) ) ) 不为空,令人惊讶的是内容

这是我的结果:

function call(){    
    $("#para").html( 'oops css gone');
}  

0 个答案:

没有答案