Questions tagged [nsrangeexception]

NSRangeException is raised when you access a range outside its normal bounds. Range exceptions most commonly occur when looping an array starting at index 1 rather than starting at index 0 as intended.

nsrangeexception
Filter by
Sorted by
Tagged with
46 votes
2 answers
3k views

NSRangeException Out of Bounds error

I am setting the attributed text of a label, and I am getting this strange error: Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray replaceObjectsInRange:...
Chandler De Angelis's user avatar
18 votes
1 answer
23k views

NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds

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]...
Shmidt's user avatar
  • 16.6k
12 votes
3 answers
11k views

IndexOfObject return 2147483647

I have an array with 10 items. When I call "IndexOfObject" for the elements number 9 and the element number 10 Xcode return an exception: "NSRangeException" reason: '_[_NSCFArray objectAtIndex:] ...
Ortensia C.'s user avatar
  • 4,706
8 votes
2 answers
4k views

Finding out source of nsrangeexception

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 ...
user542584's user avatar
  • 2,691
6 votes
3 answers
3k views

google analytics last screen before crash for ios

My application crashes with very poor info. Is there a way that I could find the last screen name, in google analytics, when application crashes? I am tracking every screen in my application. This way ...
Lukas's user avatar
  • 2,515
5 votes
4 answers
1k views

Mixing static and dynamic UITableViewController content causes NSRangeException

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) ...
DonBaron's user avatar
  • 1,364
5 votes
3 answers
630 views

NSRangeException following Core Data migration

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 ...
David Ravetti's user avatar
4 votes
2 answers
4k views

Understanding arrayWithCapacity: method on NSMutableArray

I'm having a hard time trying to understand a method in the Objective-C's NSMutableArray class. I created an array using the arrayWithCapacity: static method of this class, just like this: ...
Daniel Bastos's user avatar
4 votes
4 answers
3k views

Index '5' beyond bounds of empty array crash

I'm building an RSS-Reader and put a refreshbutton on the right corner of the navigation bar. It works fine and I get no crashes. But if if I press the refresh button during scrolling the app crashes. ...
AmiiQo's user avatar
  • 353
4 votes
1 answer
758 views

UIScrollView setContentSize crashes with uncaught NSRangeException

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 ...
Gerstmann's user avatar
  • 5,418
4 votes
2 answers
12k views

NSRangeException, reason: 'Attempted to scroll the table view to an out-of-bounds...'

Got a UITableView that I'm populating with ChatMessage objects, that I keep in a Dictionary that is grouped by date sent like so var groupedMessages = [Date : [ChatMessage]]() I'm also keeping keys in ...
Bernhard Engl's user avatar
3 votes
1 answer
6k views

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4]' in IOS

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { data_web *current_data ; current_data = [[structured_question ...
Aragon's user avatar
  • 59
3 votes
1 answer
240 views

Modifying NSFetchRequest generating NSRangeException index 0 beyond bounds for empty array

In my latest iOS App Update, I'm seeing a significant increase in DB related crashes. I'm seeing crashes from almost every line of code that runs a fetch on the DB. Exception: NSRangeException * -[...
FishStix's user avatar
  • 5,064
3 votes
1 answer
600 views

UIWebView NSRangeException

I try to load into UIWebView of a UIViewController a 360 panorama which is in html format and built in krpano. When the panorama opens all work properly. Although after some time, I get much of these ...
hoya21's user avatar
  • 893
2 votes
2 answers
1k views

range out of bounds size 4 objective c

I have an NSString of length 4. Logically, this should work, and expYear does, but expMonth throws an out of bounds exception? expYear = [expDate substringWithRange:NSMakeRange(0, 2)]; expMonth = [...
dsuma's user avatar
  • 1,010
2 votes
1 answer
2k views

Setting attributedText, NSRangeException error

Trying to set my UIText view's attributed text properties via selection. Almost works. Action to set text with red font color below. This works sometimes, but often gives an error: Terminating app ...
OWolf's user avatar
  • 5,072
2 votes
1 answer
2k views

NSRangeException being thrown when creating a subarray using range [duplicate]

This is a very odd error that I'm getting. It's this: 'NSRangeException', reason: '*** -[NSArray subarrayWithRange:]: range {2, 3} extends beyond bounds [0 .. 3]' What I don't understand is that the ...
arc4randall's user avatar
  • 3,274
2 votes
1 answer
412 views

Xcode 7 beta crash on autocompletion - NSRangeException

I get this crash each time Xcode uses autocompletion. Steps - Use any system library - Ex.: UIColor I type "[UIColor col" and get a list of suggestions (colorWithCGColor - etc) I hit the delete key ...
Shantanu's user avatar
  • 315
2 votes
1 answer
1k views

NSAttributedString: check if NSRange is valid

Given a NSRange and a NSAttributedString, what's the best way to verify that the range is valid, and won't exceed the bounds of the attributed string? I am trying to do this: [...
Z S's user avatar
  • 7,177
2 votes
3 answers
3k views

Swift 2.0: NSRangeException, Range or index out of bounds

Context: I come from 15-20 years of JavaScript, Ruby and (modern) PHP. I've been poking at Swift over the last year, and I'm brand-new to Cocoa. Here's a simplified test case that I'm running in ...
Ryan Parman's user avatar
  • 6,905
2 votes
2 answers
609 views

RangeException on Array objectAtIndex <huge number> #Core Data

Novice to Programming** Getting a "beyond bounds" NSRangeException when trying to access an object from a mutable array. The error is showing a long number for the objectAtIndex, but the array only ...
Clark's user avatar
  • 416
2 votes
2 answers
818 views

Index beyond bounds while setting up a cell in my table view

While setting up a cell in my table view, I had this issue: Log: * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .....
sabari vasagan's user avatar
2 votes
1 answer
837 views

Swift UITableViewController numberOfSections index 1 beyond bounds [0 .. 0] With Static Cells

I have a UITableViewController, with a static 5 sections and 2 rows per sections, but the last section with 1 row. I've created the table in storyboards and set the number of sections and rows via ...
Nick H's user avatar
  • 227
2 votes
0 answers
920 views

[NSConcreteTextStorage attributesAtIndex:effectiveRange:]: Range or index out of bounds

I use uitextview for input text multi-line, and limit line of text input. In iOS7, app will be crash when input full text and typing multi stage character(Japanese Language). (I cannot repeat this ...
Tanakorn.K's user avatar
2 votes
3 answers
2k views

NSRangeException using -[ALAssetsGroup enumerateAssetsUsingBlock:]

I am currently using some pretty standard code to enumerate assets in a group. Except now I have a new error *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[...
The Lazy Coder's user avatar
1 vote
2 answers
3k views

Substring with range crashes

I am having strange problem. The following substring code crashes with NSString *string4 = @"<p>some</p><img></img><p></p>end of the story": [string4 ...
RealityOD's user avatar
1 vote
2 answers
8k views

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 2 beyond bounds for empty NSArray

Error in log: * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSArray0 objectAtIndex:]: index 2 beyond bounds for empty NSArray' *** First throw call stack: ( ...
sabari vasagan's user avatar
1 vote
1 answer
487 views

NSMutableArray remove objectAtIndex NSRangeException IOS

I get NSRangeException error when I try to removeObjectAt:0 . I don't know how that is even possible. -(void)removePoints:(ccTime *)tm { NSLog(@"naughty %@",_naughtytoucharray); if ([...
Mord Fustang's user avatar
  • 1,533
1 vote
1 answer
4k views

iOS Xcode 4.2 Master-Detail Application Template Throwing NSRangeException

Newbie question here ... I've created a Master-Detail Application project in Xcode 4.2 using ARC and Storyboard. I've modified the template to be: MasterViewController.h #import <UIKit/UIKit.h&...
Mitch's user avatar
  • 669
1 vote
2 answers
1k views

Strange NSRangeException beyond bounds error in NSMutablearray

In my app, I'm doing audio analysis. Every second, I'm calling some methods, like this one : - (NSNumber *) arrayAverage: (NSMutableArray *)array { int countArray = [array count]; if(!...
jcr's user avatar
  • 303
1 vote
2 answers
342 views

Looping through an array, index error

I am creating a UIScrollView that scrolls sideways and has a number of buttons and labels (that go with the buttons) that I am adding programmatically. I have 44 buttons and labels, so I want to ...
tyler53's user avatar
  • 429
1 vote
2 answers
6k views

'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]'

I'm trying to delete some items but i'm receiving this NSException: 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]' Here is my code: -(void)...
user avatar
1 vote
1 answer
991 views

NSRangeException from UITableViewController

I can't solve the mystery of my NSRangeException. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView ...
Destron's user avatar
  • 414
1 vote
1 answer
151 views

numberOfRowsInSection not overriding Attributes Inspector

In Swift 2, working on a UITableView that will dynamically create cells based on the contents of a dictionary. The dictionary has 38 entries. When I manually set the Table View Section to have 38 rows ...
pruette's user avatar
  • 53
1 vote
1 answer
425 views

Swift: NSRangeException when initializing UITableViewCells

I'm having some minor issues trying to get my UITableView to function correctly. This is what the error looks like: * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[...
user avatar
1 vote
1 answer
815 views

strange crash in iOS

There is a group of crashes reported by crittercism. I've never reproduced it but there're about 50 times from different users in 1 weeks. 21 XXApp 0x0000000100129fb0 -[NSString(XXFormat) ...
canius's user avatar
  • 93
1 vote
1 answer
579 views

Checking user inputted URLs in Objective C/XCode 6 - NSRangeException

G'day, I'm attempting to check user-inputted URLs in a browser app. The aim is to add the http:// etc scheme if the user doesn't input it, and to assume they're after a Google search if they include ...
northsydneybears's user avatar
1 vote
1 answer
1k views

NSRangeException in TableView with Sections [indexPath Row] goes out of range

Here is the error printed out to the console: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 1]' *** First ...
user1066524's user avatar
1 vote
1 answer
110 views

'NSRangeException' while reading data from a file

I am trying to save data when the home button is pressed. Here is my relevant code. - (NSString *) saveFilePath { NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, ...
Ali Sufyan's user avatar
  • 2,038
1 vote
0 answers
233 views

NSRangeException - Breakpoint not giving me any clues

Forgive any errors here, I'm a coding hobbyist and a newbie to SO question asking, but have done my best to track down this bug and failed. I'm getting a crash moving between SKScenes, but only if ...
Matthew R's user avatar
1 vote
0 answers
133 views

SceneKit error - index 0 beyond bounds for empty array

In this game, once the player dies, all of the variables are reinitialized and a tap-to-play label should appear. Instead, the app crashes with the following message: Terminating app due to uncaught ...
squarehippo10's user avatar
1 vote
1 answer
84 views

A loop causing NSRangeExceptionindex

I got a simple loop, in which I want to append a variable to an array if it exists. Every variable is checked... Anybody knows why this is crashing? This is the error I get: NSRangeException', ...
Alfro's user avatar
  • 1,544
1 vote
2 answers
124 views

Receive NSRangeException error message "objectAtIndex beyond bounds"

In one class called LevelSelectViewController, I have this public property @property (nonatomic, strong, getter=getLevelNumber) NSNumber *levelNumber; which stores an int value based on a ...
Frank's user avatar
  • 107
1 vote
0 answers
621 views

NSRangeException beyond bounds when inserting row into a tableview off screen iOS

I'm having a problem with my Swift/iOS app when it comes to dealing with a UITableView using static cells. My tableview has a couple of sections in it, which in turn each section has a couple of rows ...
user5823259's user avatar
1 vote
1 answer
349 views

Nested UITableView in a UITableView Causes NsRangeException with Index Out of Bound in iOS

I have an iOS 7/8 application. In a view I have a static UITableView with given number of cells - 17 in my case. One of the cells contains another UITableView with dynamic cells. In the case described ...
Mihail Velikov's user avatar
1 vote
0 answers
140 views

xcode project export error

I have this problem: I sent to a friend my xcode project, he is able to open and run without errors, but at some point the app crashes. More precisely app manages a sqlite database that stores the ...
Gio Bact's user avatar
  • 541
1 vote
3 answers
202 views

App crashing when table cell expanded

I have a system in place to add a cell to a section when the already existing cell is pressed. The app crashes when I try to expand any section after and including indexpath 3. It generates the ...
user3126921's user avatar
1 vote
0 answers
437 views

Application crash NSRangeException

We have created a Phonegap application for iOS with Xcode4.5 and integrated Bing map using HTML. we are using cordova-1.9.0 When we run our application in iOS7 then application crashes with below ...
user2834478's user avatar
1 vote
1 answer
386 views

-[NSMutableArray removeAllObjects] and -[NSMutableArray addObject:] throw NSRangeException

The first crash was caused by a call to removeAllObjects, and the second, addObject: 2013-08-01 21:54:05.706 Zipper[1754:1803] An uncaught exception was raised 2013-08-01 21:54:05.721 Zipper[1754:...
Josh The Geek's user avatar
1 vote
0 answers
278 views

NSRangeException while adding objects to NSMutableArray

I am programming the search bar logic in an iOS application. I have 1 NSArray "results", which has the entities returned from a NSFetchRequest, and an empty NSMutableArray "resultados" where I want ...
mariogarranz's user avatar