使用带有参数值的AFNetworking 3.0调用Web服务不是英文字符(古吉拉特语/印地语)。
我的参数如下: 1)令牌ID 2)申请 3)用户名 4)addUpdateCustomerJson
这里的'addUpdateCustomerJson'参数是json字符串,因此它将包含NSMutableDictionary和NSMutableArray。
Parameters: AddressDetails = "[\n {\n \"Pincode\" : \"400031\",\n \"State\" : \"Maharashtra\",\n \"Lattitude\" : 19.017614699999999,\n \"AddressLine1\" : \"Victory Container Movies\",\n \"Longitude\" : 72.856164399999997,\n \"AddressLine2\" : \"Wadala\",\n \"Country\" : \"India\",\n \"Type\" : 1,\n \"City\" : \"Mumbai\"\n }\n]";
Application = SalesPro;
CompanyID = 1;
CustVendorDetails = "{\n \"MobileNo\" : \"345345345334\",\n \"ContactNo\" : \"\",\n \"LandlineNo\" : \"\",\n \"Tax_Type\" : \"VAT\",\n \"CustomerCode\" : \"\",\n \"DistributorID\" : 0,\n \"CreatedBy\" : 18,\n \"Name\" : \"\U0ab9\U0abf\U0ab0\",\n \"EmailTo\" : \"\",\n \"EmailID\" : \"\",\n \"CompanyTypeID\" : 1,\n \"Type\" : \"U\",\n \"BirthDate\" : \"\",\n \"PrimatyUserID\" : 18,\n \"TaggedToID\" : 18,\n \"SegmentID\" : 0,\n \"CustomerClass\" : 1,\n \"Description\" : \"\",\n \"Key_Customer\" : false,\n \"CompanyID\" : 1,\n \"CustomerGSTNo\" : \"\",\n \"OwnerID\" : 18,\n \"ContactName\" : \"\"\n}";
TaggedUsersList = "[\n {\n \"TaggedUserID\" : 18\n }\n]";
TokenID = BBF7B1E82D75939E9F29FCC59F0EF542;
UserID = 18;
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
NSLog(@"Customer Add/Edit JSON Object %@",[maindict description]);
[manager POST:kWSUrlAddCustomerVendor parameters:maindict constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
} progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[SVProgressHUD dismiss];
NSDictionary *dict = (NSDictionary *)responseObject;
NSLog(@"%@",[dict description]);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
}];
响应:
data = {
AddressList = (
{
AddressID = 2056;
}
);
CompanyID = 1;
MobileNo = 345345345334;
Name = "\U00e0\U00aa\U00b9\U00e0\U00aa\U00bf\U00e0\U00aa\U00b0";
TaggedToIDList = (
{
ID = 4866;
}
);
isActive = 1;
};
message = "Customer Created successfully";
status = Success;
问题在“名称”字段中
采用UTF编码格式
预先感谢