我有一个NSString类别,其中有一个简单的trim方法。而且看起来我的字符串是NSTaggedPointerString,并且无法正确评估。
错误:
[NSTaggedPointerString trim]: unrecognized selector sent to instance
该怎么办?
#import <Foundation/Foundation.h>
@interface NSString (StringHelper)
- (NSString *)trim;
@end
#import "NSString+Helper.h"
@implementation NSString (StringHelper)
-(NSString *)trim
{
return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}
@end