You could use a regular expression to accomplish this:
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@" +" options:NSRegularExpressionCaseInsensitive error:&error];
The pattern is a space followed by one or more occurrences of space. Replace this with a single space in your string:
NSString *trimmedString = [regex stringByReplacingMatchesInString:user_ids options:0 range:NSMakeRange(0, [user_ids length]) withTemplate:@" "];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…