logo
down
shadow

Terminating app due to uncaught exception 'NSRangeException' when calling dequeueReusableCellWithReuseIdentifier:forInde


Terminating app due to uncaught exception 'NSRangeException' when calling dequeueReusableCellWithReuseIdentifier:forInde

By : scriptius
Date : November 25 2020, 07:06 PM
Hope that helps Not sure if it is a bug in iOS 11 or not, but the crash is cost by the following code of trying to dequeue a cell for sizing purposes in collectionView:collectionViewLayout:sizeForItemAt: and works fine on iOS 12 and above:
code :
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
    let cell = self.collectionView(collectionView, cellForItemAt: indexPath)
    let size = cell.systemLayoutSizeFitting(...)
    return CGSize(width: collectionView.frame.width, height: size.height)
}
let nib = UINib(nibName: "MyCell", bundle: nil)
collectionView.register(nib, forCellWithReuseIdentifier: "MyCell")
2018-11-02 10:15:01.744674-0400 Flights[385:17563] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x18555ed8c 0x1847185ec 0x1854f7750 0x1854e48ac 0x18f266b04 0x18f266084 0x18f265fd8 0x18f265eb8 0x18f2859dc 0x18f286c00 0x18f286a2c 0x100b1c304 0x100ea8b6c 0x100eaa24c 0x100eaa30c 0x100eaa680 0x185566580 0x185445748 0x18544a56c 0x10573e0c8 0x1855642d4 0x18544a41c 0x18f266f60 0x18f266084 0x18f265fd8 0x18f265eb8 0x18f265500 0x18f264730 0x18f133770 0x1896d525c 0x1896d93ec 0x189645aa0 0x18966d5d0 0x18966e450 0x185506910 0x185504238 0x185504884 0x185424da8 0x187407020 0x18f40578c 0x100b8c760 0x184eb5fc0)
libc++abi.dylib: terminating with uncaught exception of type NSException
let nib = UINib(nibName: "MyCell", bundle: .main)


Share : facebook icon twitter icon
Help me ...Terminating app due to uncaught exception 'NSRangeException',

Help me ...Terminating app due to uncaught exception 'NSRangeException',


By : Joey
Date : March 29 2020, 07:55 AM
should help you out does the array has any data when you show the table? if you give a default number of cells that is bigger than 0 and there is no data in the array..then you will receive the error you described.
code :
'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    return [appDelegate.ArrParseData count];
}
Terminating app due to uncaught exception 'NSRangeException'

Terminating app due to uncaught exception 'NSRangeException'


By : Grande
Date : March 29 2020, 07:55 AM
Hope that helps In the Xcode debugger, set either a global breakpoint at "replaceObjectAtIndex: withObject" or look for any and all calls to "replaceObjectAtIndex: withObject" in your code and set breakpoints there and see if you can catch where / when the exception happens.
Here's a bit of help from Apple's Xcode documentation, I'm looking at a chapter called "Breakpoint Navigator".
Terminating app due to uncaught exception 'NSRangeException'

Terminating app due to uncaught exception 'NSRangeException'


By : Hannah Wilson
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You have a bug. Something isn't working as you expect it to work. If you insist that the bug is in the code that you posted, and that the code that you posted is correct, then you'll never find out the problem in your life.
There's a crash. Rule 1: The crash is your fault. Your code is wrong. Your task is to find which code is wrong.
App Terminating due to uncaught exception 'NSRangeException'

App Terminating due to uncaught exception 'NSRangeException'


By : Tsrtcc Buses
Date : March 29 2020, 07:55 AM
should help you out 9223372036854775807 is the unsigned cast of -1, which is NSNotFound. Per the error message, you are calling -[NSString substringToIndex:] with the result of a search that didn't find what you were looking for.
This section of code is not shown, so look for anywhere where you think you can pull apart a string, but are not properly checking that you actually can. Try running with the debugger attached and it will tell you which line of your code raises the exception reported. You can work backwards from there.
Terminating app due to uncaught exception 'NSRangeException'. libc++abi.dylib: terminating with uncaught exception of ty

Terminating app due to uncaught exception 'NSRangeException'. libc++abi.dylib: terminating with uncaught exception of ty


By : JADORE
Date : March 29 2020, 07:55 AM
it helps some times The problem is in this line let formatted_address = ide![0]
If an array is empty, you can't get it's first element with [0] because there is no element at all!
code :
if ide!.count > 0 {
    //Your code
}
if let id = request!["results"], let ide = id as? NSArray {
    let formatted_address = ide[0]
    let fors = formatted_address as! NSDictionary
    //rest of your code
}
Related Posts Related Posts :
  • Unclear about releasing CFDictionaryRef
  • CordovaError: Promise rejected with non-error: Error code 65
  • How to append NSMutable strings into a UILabel
  • CustomCell label value does not change
  • Display ad in iAd Bannerview iAd Network
  • Warning: "Could not get traitsetID for iPhone11,6" (Assets.xcassets)
  • Changing root view controller after iOS app has loaded.
  • SocketRocket and iOS certificate pinning
  • Draggable UIButton Snap To a Circle Path
  • Running FireBase in the background
  • resizing UIPopoverController to fit UITableController
  • UICollectionView Exception Crash
  • targeting iOS5 - will it work on iOS6 also?
  • FBLoginView get email
  • Scale UIImages height to UIImageView height
  • Creating a custom progress indicator in ios
  • NSRunLoop API difference
  • Is it possible to inject custom settings into my iOS application "Notifications" settings dialog?
  • UIAlertview not accepting string as message
  • Axis change of stackView giving layout error
  • How to use AVAssetResourceLoader?
  • How to write block definition using properties?
  • iOS connect/reconnect to Bluetooth device when using external-accessory and MFi
  • Saving XMPP Multi User chat messages through XMPP MessageArchiving in iOS
  • Deciding iOS version: pros and cons
  • iOS: Resigned app cannot access keychain through security API
  • How can I set To and Subject fields in an E-Mail being sent by UIDocumentInteractionController?
  • Updating uilabel in view controller underneath another
  • Maximum time Intervel for NSTimer
  • Delete Core Data Entry from Table View Controller
  • How to unload UIViewcontroller from memory?
  • Compressing UIImage as Far as Possible?
  • Optimizing workflow to update internally owned cocoapods dependencies?
  • Formatting an NSDate with Abbreviated Month/Day Names
  • I'm creating a quiz game with 4 answers and I want to add score
  • Tap Gesture to Hide Navigation Bar, Tab Bar, and Status Bar
  • FBSessionStateClosedLoginFailed when I am logged in through Settings
  • CGRect positioning according to center point
  • iOS: Update table view datasource with animations without core data
  • iOS : Where to start for AliPay integration?
  • Routing App Coverage File missing but not needed?
  • Drawing on a zoomable view
  • Append NSStrings and NSNumber to NSMutableArrays and make NSMutable dictionary
  • Collision without physics (Cocos2D + Box2D iOS)
  • Creating a percentage based iOS layout
  • Update tableView row from AppDelegate Swift 4
  • Assigning return value of a class method to a variable error
  • how to display circular progress in delphi ios apps?
  • I can't figure how to fix this Expected identifier or '('
  • How to Test APIs in Swift 4?
  • Link error /Build/Products/Debug-iphonesimulator file not found
  • working with a very large JSON object in iOS
  • Turn off part of the iPhone Screen
  • Phonegap 3.0 app with facebook login using xCode
  • How to add interstitial admob ads to my ios project
  • adding tapku calendar to ios app
  • Add an alertcontroller in a global swift file?
  • Take square image with Cordova (Phonegap) Camera API?
  • Amazon S3 policy allowing only upload not overwrite
  • How to change the UILabel content by tapping?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org