Make an NSURL with an encoded plus (+)

前端 未结 7 1167
灰色年华
灰色年华 2021-02-14 01:39

I need to pass a timestamp with a timezone offset in a GET request, e.g.,

2009-05-04T11:22:00+01:00

This looks like a two arguments

7条回答
  •  盖世英雄少女心
    2021-02-14 01:46

    encode you string by using below code

    NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)self,NULL,(CFStringRef)@"+",kCFStringEncodingUTF8);

    this will encode + of you string which will prevent replacement of + by %2b while posting data in post method

提交回复
热议问题