Himoo
Himoo

Reputation: 1

How to post parameter like ' \u0001[xxxx] ' using AFNetworking

I made this, but is error [NSString stringWithFormat:@"%@", @"\u0001[xxxx]"]

    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSString stringWithFormat:@"%@", @"\u0001[xxxx]"], @"content",
                            [NSNumber numberWithBool:anonymous],@"aaaaa",
                            nil];

return [manager POST:submitCommentUrlString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject){
    ...

} failure:^(AFHTTPRequestOperation *operation, NSError *error){
    ...
}];

Upvotes: 0

Views: 136

Answers (2)

Himoo
Himoo

Reputation: 1

[NSString stringWithFormat:@"%C", 0x1]

This is \u0001

Upvotes: 0

jatin bhagat
jatin bhagat

Reputation: 69

Try using

[[NSString stringWithFormat:@"%@", @"\u0001[xxxx]"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

instead of

[NSString stringWithFormat:@"%@", @"\u0001[xxxx]"]

in order to set object in a dictionary.

Upvotes: 2

Related Questions