I’m experiencing this weird effect where calling location on rangeOfString is returning a very large value when it shouldn’t…
my code looks like this:
NSRange range = [string rangeOfString:subString];
NSLog(@"range is %@", NSStringFromRange(range));
this logs out to range is {2147483647, 0}
Can’t figure out why exactly.
Some things that might be causing this:
- The substring is generated from an array of bytes using NSString’s
initWithBytes method - The substring tells me its an NSCFString * but also says ‘variable is
not NSString’ - the substring logs in the console as expected
any help greatly appreciated
here is somethign that is striking me as weird:

That just means that your substring is not present in your string, do the following to verify this: