如果我有这个方法:
+ (NSDictionary *)dictionaryFromQueryString:(NSString *)queryString
{
NSMutableDictionary *this = [[NSMutableDictionary alloc] init];
NSArray *fields = [queryString componentsSeparatedByString:@"&"];
for(NSString *field in fields)
{
NSArray *fieldParts = [field componentsSeparatedByString:@"="];
NSString *value = @"";
if(fieldParts.count > 1)
{
value = [[fieldParts subarrayWithRange:NSMakeRange(1, fieldParts.count - 1)] componentsJoinedByString:@"="];
}
[this setObject:unescape(value) forKey:unescape(fieldParts[0])];
}
return this;
}
那么我返回 aNSMutableDictionary
而不是 a是不好的做法NSDictionary
吗?
我应该将其转换为NSDictionary
withreturn [this copy];
吗?