문제

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];

[manager GET:@"http://xml.memurlar.net/mobile/json/news/headlines.aspx" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"Error: %@", error);
}];

I am using latest AFNetworking. I want to get object from the link that I used above. But I get following error:

Error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid escape sequence around character 94.) UserInfo=0x1203e950 {NSDebugDescription=Invalid escape sequence around character 94.}

Any solution for that?

도움이 되었습니까?

해결책

Yeah that API isn't returning a valid JSON structure. The problem is right here:

"KPSS\'de kim hangi oturuma girecek?"

That \ is not a valid escape character and needs to go. What are you using to serialize that JSON?

다른 팁

//do not use the default json serializer.
manager.responseSerializer=[AFHTTPResponseSerializer serializer];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top