views:

44

answers:

2
NSString *originalString = entriesResultStr;
NSRange jarvisRange = [originalString rangeOfString:@"favoriteCount"];
NSString* substring = [originalString substringToIndex:jarvisRange.location];

For some reason, when I use NSRange, my app window won't open, but when I comment it out, my app opens fine.

Any ideas?

+1  A: 

Perhaps @"favoriteCount" isn't in originalString and jarvisRange is being set to { NSNotFound, 0 }.

James Huddleston
A: 

What do you have in originalString?

It would help if you explained what is in your originalString and what are you trying to achieve.

From what I see, the substring should contain a substring from originalString starting from beginning up to the favoriteCount.

  • Is that what you were trying to do?
  • What do you do with the substring after that?
stefanB