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.
Questions tagged [nsrangeexception]
130 questions
0
votes
1 answer
Cannot remove an observer for the key path "count"
I am getting:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer for the key path "count" from because it is not registered as an observer.'
I have a background…

Trygve
- 1,317
- 10
- 27
0
votes
2 answers
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array
So I have a UITableView, and the app crashes with this error every time that the array does not have any items in it. What is strange is that I have another table that does not crash when it has zero objects in the array, and I am using almost…

hermt2
- 844
- 3
- 14
- 33
0
votes
1 answer
UITableViewController causes NSRangeException on reloadData with valid data
So I am getting this weird crash when reloading my tableView. It loads fine when the categories array is empty, but as soon as I add values to the array, I get an NSRangeException when reloading the tableView. Even if I have 40+ items in the…

Charlie Oder
- 51
- 3
0
votes
1 answer
Error within tableview when cells are switching sections
So in my table view, I have an array called dataArray and it's getting its objects from a server using JSON. I added a button to each cell and when the button is clicked the cell is supposed to move to another section/ or another array called…

WokerHead
- 947
- 2
- 15
- 46
0
votes
2 answers
iOS - Removing An Object In NSMutableArray Throws NSRangeException
I am using TCP short connection to send data to a host. When I want to send a data to a host I will instantiate a socket, store the socket instance to an array and then remove it later on when the data is written successfully.
This is how I did…

JLT
- 3,052
- 9
- 39
- 86
0
votes
1 answer
Crash that only occurs via hockeyapp builds?
I am having an issue where a crash only occurs when the application is installed via HockeyApp, not via Xcode.
This is the report I get from HockeyApp:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFArray…

arcade16
- 1,535
- 4
- 23
- 45
0
votes
0 answers
index 2 beyond bounds exception while trying to fetch record from core data
I have a segmentedControl button and a table view below the segmentedControl.
In my viewDidLoad method, im fetching the values from core data and populating the array as follows,
NSError *Error = nil;
APIRequest *apiRequest = [[APIRequest…
user6038900
0
votes
1 answer
NSRangeException when I have multiple pickerViews for multiple textfields
#import "ProfileViewController.h"
@implementation ProfileViewController{
NSArray *currentArray;
UITextField *currentTextField;
}
@synthesize picker, Feets, Inchs, Weights, Months, Days, Years, HeightValue, WeightValue,…

Yueyang Qin
- 3
- 4
0
votes
1 answer
NSMutableAttributedString Fatal Exception: NSRangeException
When I try to apply attributes to the sub-string, I sometimes get a crash in following code:
// Dummy strings
let originalString = "Some example string"
let searchSubString = "exam"
// Get range of sub-string for which new attributes are to be…

O Fenômeno
- 445
- 3
- 14
0
votes
2 answers
Trying to extract an image URL from an NSString
I'm trying to do an RSS Feed application for iOS and I'm trying to get the image URL from the description tag of the xml file (of the RSS Feed)
Here's my current code:
static NSMutableString *title;
static NSMutableString *linkPost;
static…

Ziph0n
- 197
- 1
- 1
- 7
0
votes
1 answer
Why does setting an attributedText's background raise an NSRangeException error?
So I'm trying to set a blue background color to a UILabel's attributed text dynamically as the user pans their finger along the screen but I can't for the life of me figure out why I'm getting an NSRangeException with the following error message:…

cyril
- 3,020
- 6
- 36
- 61
0
votes
1 answer
NSRangeException at particular Segue
I have this particular segue that keeps giving me NSRangeException. I have no code at all in prepareForSegue. I put a break point in viewdidload of that view controller and it is executed with no problem. Seems that the exception occurs in IOS…

KMC
- 1,677
- 3
- 26
- 55
0
votes
2 answers
iOS: Terminating application due to uncaught exception 'NSRangeException'
I have searched through a number of these NSRangeException error threads but can't seem to find an answer to my question. Here is my error:
2015-08-15 17:28:43.793 UTK Recruiting[8794:254203] * Terminating app due to uncaught exception…

Alex Cauthen
- 89
- 7
0
votes
1 answer
NSRangeException in cellForRowAtIndexPath with selectedSegmentIndex
I try to switch cell.textLabel.text (two different arrays) with selectedSegmentIndex.
The first one with selectedSegmentIndex = 1 works fine.
but the second makes a crash :
uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM…

Vjardel
- 1,065
- 1
- 13
- 28
0
votes
1 answer
Create a UIView title of a push view using the index of an array
I have a UITableView that pushes to a UIView when the user taps the UITableViewCell. I want to make the title of the push view the text from the cell that the push view is coming from. I am trying to declare an NSUInteger when the row is selected to…

njyulan
- 43
- 8