-1

I am making an app, and I am doing my first test right now that should just show the basic layout and a little functionality. I have of course found all the compile time and runtime errors that xcode has caught, and I assume there are at least a few bugs will just make the app act weirdly, but I want to fix those after the app has actually run. Unfortunately, I am getting a SIGABRT error. First off, I am not even using Main.storyboard or ViewController.swift, so that is not the issue. No broken segues. This is what the console says: Console message.

So first I thought I just had an array out of bounds exception ("NSRangeException"), but the thing is, I never used an NSArray (I did use normal arrays though, and I am not ruling out a range out of bounds exception there, but I want to know why the console is saying it is an NSArray. If it is something else, I obviously need to know). Here is a "Stack trace" (or at least I assume so) also which I saw as a suggestion to find and error on a similar question (it was objective-c though, and he actually had an NSArray). Here is the link: similar question I don't know how to trace that back to the source, but that what it looks like leading up to the error. Basically, why I am asking this question is:

  1. If you can tell me that I am completely wrong about thinking I have an array out of bounds error and what it is instead, please do that.
  2. If you agree with me in thinking that is likely the issue, please explain to me why the compiler would refer to it as an NSArray; as far as I know, these are two completely different data structures.
Liam Keeley
  • 187
  • 1
  • 10
  • 1
    Add exception breakpoint and check where its actually breaking – Dharmesh Kheni Jul 26 '18 at 06:01
  • Are you using any external libraries? – Skywalker Jul 26 '18 at 06:09
  • No. I mean UIKit of course. And Foundation. – Liam Keeley Jul 26 '18 at 06:17
  • The error clearly says that you are going to get the item at index 1 from an empty array which of course doesn't exist (It's irrelevant that the error message mentions `NSArray`). Show the code. Most likely it's an asynchronous issue. – vadian Jul 26 '18 at 07:34
  • Copy/paste error message and Full call stack. You might not use directly `NSArray`, but CocoaTouch might to it internally. So please, show full error message. Also, I don't think Apple recode all their framework in Swift, they make them cohabitate, so at some point you'll use a NSArray without seeing it, even if you are using yourself a Swift Array. – Larme Jul 26 '18 at 08:16

1 Answers1

1

Without code is very hard help you.

But you can check where is the error with an exception breakpoint.

Click on the Breakpoint navigator tab (the tab selected in the image):

enter image description here

Then click on the plus button in the bottom and select Exception breakpoint:

enter image description here

After this, you can reproduce the issue and when the app crashes the debugger stop all at the line where is our (empty) nsArray.

Kerberos
  • 4,036
  • 3
  • 36
  • 55
  • Thanks a lot; I know its probably pretty simple, but I didn't know you could do that. Thats what Dharmesh Kheni told me to do as well, and I found the error. And @Larme did a good job of explaining why its an NSArray, so thanks for the help. – Liam Keeley Jul 26 '18 at 17:43