質問

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