我收到来自我的服务器的响应,它看起来像这样:
2012-09-12 16:29:11.690 WhatIsIt[1763:707] (
{
qid = ebb81a9c0c2125c9f12fee33c281dfe2ef5c1596;
"qid_data" = {
labels = Wristwatch;
};
} )
当我解析这样的"qid"
值时:
- (void)updateCompleteWithResults:(NSArray*)results{
NSLog(@"%@",results);
NSString *qid = [results valueForKey:@"qid"];
对象在NSString
字符串周围得到一个括号(我不知道如何)看起来像这样:
2012-09-12 16:34:17.979 WhatIsIt[1785:707] (
2e1da5854f3b4f02cd967293cd1364e6d3e0b76a
)
所以我尝试使用:
NSString *string = @" spaces in front and at the end ";
NSString *trimmedString = [string stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
应用程序崩溃了,知道吗?