0
나는 with Json Delete 메서드가 있습니다. 나는 인터넷 주위를 서핑했고 아무것도 얻지 못했다.객관적인 C에서 JSON DELETE 메서드가 작동하지 않습니다?
다음은 Json 삭제 방법을 시도한 코드입니다. -JSONValue 실패
: 그것은 단순히
NSString *posturl=[NSString stringWithFormat:@"%@/spottings/%@/media/%@.json?auth_token=%@",_BASE_API_URL,[_spotting_id_array objectAtIndex:button.tag],[_ex_media_id_array objectAtIndex:button.tag],_ex_auth_token_str];
NSLog(@"posturl:%@",posturl);
// Prepare string request
NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"%@",posturl]];
// Prepare URL request
NSMutableURLRequest *request =[[[NSMutableURLRequest alloc] init] autorelease];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
// Set the URL to request
[request setURL:url];
// Set the URL method
[request setHTTPMethod:@"DELETE"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *urlData, NSError *error){
if ([urlData length] >0 && error == nil)
{
// Get JSON as a NSString from NSData response
NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
// parse the JSON response into an object
// Here we're using NSArray since we're parsing an array of JSON status objects
_results = [data JSONValue];
NSLog(@"_results:%@",_results);
}
else if ([urlData length] == 0 && error == nil)
{
NSLog(@"Nothing was downloaded.");
}
else if (error != nil){
NSLog(@"Error = %@", error);
}
}];
오류 코드 "를 JSON 값은 실패"를 반환합니다. 오류 추적은 다음과 같습니다 ( "오류 도메인 = org.brautaset.JSON.ErrorDomain 코드 = 10 \"쓰레기 JSON \ "사용자 정보 = 0x8195240 {JSON 후 NSLocalizedDescription은 = 쓰레기가}"
삭제 안 함 NSString * 데이터의 JSON 응답 표시 – San
오케이, JSON 응답이 손상되었다는 오류가 발생합니다. 바이트를 출력하여 바이트를 인쇄 할 수 있습니까? –