stringByAddingPercentEscapesUsingEncoding was deprecated in 9.0 .How to do this?

后端 未结 5 697
野性不改
野性不改 2020-12-29 03:56

I\'m a junior developer, and I got a code for this:

(NSString *)encodedStringFromObject:(id)object {
    return [[object description] stringByAddingPercentEs         


        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 04:57

    You can use stringByRemovingPercentEncoding instead of stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding

    [@"string" stringByRemovingPercentEncoding];

提交回复
热议问题