If I write it as follows no deprecation alert shows up:
NSArray *aboutInfo=[NSArray arrayWithObject:@"blah"];
CGSize textSize = [[aboutInfo objectAtIndex:0] sizeWithFont:[UIFont systemFontOfSize: 14.0] constrainedToSize:wSz2xh lineBreakMode:NSLineBreakByWordWrapping ];
However this is marked as deprecated:
NSString *aboutInfo=@"blah";
CGSize textSize = [aboutInfo sizeWithFont:[UIFont systemFontOfSize: 14.0] constrainedToSize:wSz2xh lineBreakMode:NSLineBreakByWordWrapping ];
Both work fine.
Would that mean that 1st code is safe?
I use XCode 6.2, app's project and targets deployment target is iOS7.1
I would assume XCode doesn't mark the first one as deprecated because it can't be sure the first receiver really is an
NSString
. The method you are talking about is deprecated nonetheless.