开发者

Bad access on NSString length

with

NSString *responseData = [request responseString];

I get a string like (10).

Now I want to remove the brackets to get just the number. So I f开发者_运维知识库irst wanted to get the length of the string

NSLog(@"%@",[responseData length]);

But I get a Thread 1: Program received signal: "EXC_BAD:ACCESS"

Any ideas?


NSString::length returns an unsigned integer. So, try -

NSLog(@"%i",[responseData length]); // format specifier is %i and not %@
                                    // Even better if %u is used. 

NSLog format specifiers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜