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
精彩评论