AfNetworking failure in AFHTTPRequestSerializer when I include spaces in the url

afnetworking, ios, json

Solution

ulrString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

It should solve the problem. Greets

Problem

I have a Get request with AFNetworking, the code is: ``` NSString *url = /*url*/; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil]; [manager GET:urlMessage parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {...} ``` I have to include in the url some text with spaces. But if I do that, I have an error "Assertion failure in -[AFHTTPRequestSerializer requestWithMethod:URLString:parameters:error:]" Obviously, without spaces, I don't have any error. Do you know how can I include spaces in the url without errors? Thank you.

Original source