hi experts, i try to append from NSMutableArray but the below exception, actually first 2 loop its giving result but the 3rd loop giving this exception
2009-12-04 12:01:19.044 AppBuzz[14562:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString appendString:]: nil argument'
2009-12-04 12:01:19.057 AppBuzz[14562:207] Stack: (
820145437,
837578260,
819694387,
819694291,
814894619,
814804961,
17445,
23977,
18651,
19281,
862009284,
9035,
861597328,
861596264,
861928960,
861926972,
861925524,
858687888,
819893547,
819891231,
861592584,
861585968,
8749,
8612
)
terminate called after throwing an instance of 'NSException'
my code as below
for (int i = 0; i < [student count]; i++)
{
if([student objectAtIndex:i] != NULL)
{
dic = [student objectAtIndex:i];
tempName = [dic objectForKey:@"NAME"];
tempAvgMark = [[dic objectForKey:@"AVG_MARK"] intValue];
[data appendString:@"{\"name\":\""];
[data appendString:tempName]; // here i'm having prob
[data appendString:@"\",\"avg_mark\":\""];
//[data appendString:tempAvgMark];
[data appendString:@"\"}"];
}
}
NSLOG(@"Result - %@",data);
can anyone help for 1) to append [data appendString:tempName]; 2) to append int value ([data appendString:tempAvgMark]; ) into data
thanks