R.Aarthika Rajendran R.Aarthika Rajendran - 4 days ago 4x
Objective-C Question

NSexception with sigbart error

I am trying to fetch the result from json web service. For string values it is working fine. When I try to fetch the integer value It throwing nsexeption with sigbart error.

My json result loos like this.

[{"CaseId":81,"ApplicantName":"test","ApplicantContactNo":"teas","PropertyAddress":"ewae","BankName":"Bank of India","ReportDispatcher":null,"PropertyType":"test","AssignedAt":"2016-10-07T13:01:20","Status":"Open","PropertyId":62,"EmployeeName":null,"StatusId":1}

When I try to capture the CaseId and AssignedAt it throwing error.

here is my code.

NSString * caseid = @"CaseId";
NSString * assigned = @"AssignedAt";
for (NSDictionary *dataDict in jsonObjects) {
NSString *caseid1 = [dataDict objectForKey:@"CaseId"];
NSString *assigned1 = [dataDict objectForKey:@"AssignedAt"];
dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
caseid1,caseid,assigned1,assigned, nil];
[myObject addObject:dictionary];
cell.caseid.text=[tmpDict objectForKey:@"CaseId"];
cell.days.text=[tmpDict objectForKey:@"AssignedAt"];

Any help will be appreciated.


This should work for you:

NSString *caseIdValue = [NSString stringWithFormat:@"%@",[dataDict objectForKey:@"CaseId"]];
NSString *assignedAtValue = [NSString stringWithFormat:@"%@",[dataDict objectForKey:@"AssignedAt"]];