2013-04-22 3 views
0

여기에 내 응답 코드가 나와 있습니다.등록 버튼을 누르면 앱이 다운되었지만 데이터가 데이터베이스에 성공적으로 삽입되었습니다.

NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; 

NSDictionary *LoginResult = (NSDictionary*)[responseString JSONValue]; 

NSLog(@"Success"); 

NSMutableArray *wholeJsonArray = [LoginResult objectForKey:@"Response"]; 

for(NSDictionary *countname in wholeJsonArray) 
{ 

    NSString *countryName = [countname objectForKey:@"country_name"]; 
    if(countryName) 
     [countryArray addObject:countryName]; 
    NSString *stateName=[countname objectForKey:@"state_name"]; 
    if(stateName) 
     [stateArray addObject:stateName]; 
} 

위의 코드는 국가 이름과 statename으로 검색됩니다.

내가 코드를 디버그 할 때 버튼 응용 프로그램이 라인 커서 점 NSString *countryName = [countname objectForKey:@"country_name"];에 충돌해야합니다.

+0

크래시 로그가 있습니까? –

+0

버튼 누름 코드가 다음을 요청합니다. –

+0

충돌 로그 [__NSCFString objectForKey :] : 인스턴스로 전송 된 인식 할 수없는 선택 자 0x6a6e570 –

답변

0

NSMutableArray *wholeJsonArrayNSMutableDictionary을 포함하지 않으며; 대신 NSString이 포함되어 있습니다. 배열 내용을 검토하십시오.

+0

등록 버튼을 누르기 전에 내 응용 프로그램이 정상적으로 작동하기 때문에 문제가되지 않습니다. –

+1

@MalayPatel : 아니요 문제가 있습니다. 저장중인 데이터를 확인 했습니까? –

관련 문제