首页 > 代码库 > 常见错误收集

常见错误收集

1,iOS中AFN  Get请求包含中文时崩溃

 NSString *search = @"http://60.206.137.156:8020/video_api/user/search/51234562346412e86a730d94fef7cc73/中";

[manger GET: search parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"responseObject - %@",responseObject);
        
//        NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        
//        NSLog(@"str -- %@",str);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"erro - %@",error);
    }];
会崩溃

处理方案 search = [search stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

 

常见错误收集