8
在iOS9中替换stringByAddingPercentEscapesUsingEncoding?
在iOS8及更低版本中,我可以使用: NSString *str = ...; // some URL NSString *result = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 在iOS9中stringByAddingPercentEscapesUsingEncoding已被替换为stringByAddingPercentEncodingWithAllowedCharacters: NSString *str = ...; // some URL NSCharacterSet *set = ???; // where to find set for NSUTF8StringEncoding? NSString *result = [str stringByAddingPercentEncodingWithAllowedCharacters:set]; 我的问题是:在哪里可以找到需要的NSCharacterSet(NSUTF8StringEncoding),以适当替换stringByAddingPercentEscapesUsingEncoding?