nsrangeexception

UIScrollView setContentSize crashes with uncaught NSRangeException

百般思念 提交于 2019-12-10 17:25:22
问题 Call to setContentSize crashes the application after some of the UIScrollView's contents have been removed. int toolbarHeight = [[[self navigationController] toolbar] frame].size.height; int navbarHeight = [[[self navigationController] navigationBar] frame].size.height; int totalHeight = toolbarHeight + navbarHeight; // contentWidth is 640 CGSize contentSize = CGSizeMake(contentWidth, [scrollView frame].size.height - totalHeight); [scrollView setContentSize:contentSize]; // Crash happens here

Mixing static and dynamic UITableViewController content causes NSRangeException

做~自己de王妃 提交于 2019-12-07 04:51:03
问题 I have been searching all over for this error and did find some few posts with a similar behavior but no solution that solves the problem. I have a UITableViewController (declared as Static in SB) which has to Sections: Section 0 (Recipe) is static with 4 cells, Section 1 (Flavours) should be dynamic This is the code I'm using to test: - (void)viewDidLoad { [super viewDidLoad]; rows = [[NSMutableArray alloc] initWithArray:@[@"test",@"test",@"test",@"test",@"test",@"test",@"test"]]; } -

NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds

梦想的初衷 提交于 2019-12-05 17:39:11
问题 I try to assign attributes to 3 last chars of newClock string, which is @"3:33:23" . However I get an error when construct NSRange : NSMutableAttributedString *mas = [[NSMutableAttributedString alloc]initWithString:newClock]; [mas addAttributes:@{NSForegroundColorAttributeName:[UIColor grayColor], NSFontAttributeName:[UIFont fontWithName:@"HelveticaNeue-Light" size:12]} range:NSMakeRange(newClock.length-3,newClock.length)]; 回答1: NSMakeRange(i, j) creates a range with location i and length j.

Mixing static and dynamic UITableViewController content causes NSRangeException

家住魔仙堡 提交于 2019-12-05 09:18:06
I have been searching all over for this error and did find some few posts with a similar behavior but no solution that solves the problem. I have a UITableViewController (declared as Static in SB) which has to Sections: Section 0 (Recipe) is static with 4 cells, Section 1 (Flavours) should be dynamic This is the code I'm using to test: - (void)viewDidLoad { [super viewDidLoad]; rows = [[NSMutableArray alloc] initWithArray:@[@"test",@"test",@"test",@"test",@"test",@"test",@"test"]]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 2;

Finding out source of nsrangeexception

北慕城南 提交于 2019-12-05 04:09:13
I have an NSRangeException error that does not occur all the time(especially when I am debugging). It comes up randomly, and I am unable to figure out where it is coming from. I have lots of array manipulation, so its difficult to eliminate it that way. My question is whether I can get a clue , for example class and line number from the debugger output, for example what are the numbers 12109 and 707?: 2012-03-15 09:25:15.303 appname[12109:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 0]' Any

NSRangeException following Core Data migration

人盡茶涼 提交于 2019-12-04 07:40:02
After adding a new Core Data model version to my app, I performed a lightweight migration, apparently successfully. The migrated file loaded fine, but upon the first attempt to access an attribute via a particular relationship, the app crashes with an NSRangeException: '*** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0 .. 35]' . This relationship worked fine prior to the migration. I know from other posts here that 4294967295 is really -1 , but the only thing I can identify with 36 items in my app/data is that there are 36 total entities in the data model (for reference, the