Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

thread 1 EXC_BREAKPOINT (code=1, subcode=0x101959bfc) Swift

Tags:

ios

swift

xcode8

I try to update my project to Swift 3 and my app crash just after launching Xcode display the following message:

thread 1 EXC_BREAKPOINT (code=1, subcode=0x101959bfc)

here's the line where the problem happened

var list:[PFObject]! = []
           (...)
let x = list[indexPath.row - 1]

let text:Int = (x["text"] as! NSArray)[0]  as! Int //The line where the error is displayed 

The console only said that:

(lldb)

I've removed all the breakpoints from the breakpoints navigator with no result, the issue happened both on device and on simulator. (I use Xcode 8.2) Thanks a lot for your help

like image 469
Mansour Avatar asked Jul 02 '26 03:07

Mansour


1 Answers

Take a look at the stack trace printed right before (lldb), and break down that statement in smaller pieces if is still hard to understand where the error actually is.

Considering the line the pointer is at, it could be that x["text"] is not an array, that the array is empty, or that the element is not an int.

In other words, those force unwrap could fail or the array could be empty.

like image 154
uraimo Avatar answered Jul 03 '26 18:07

uraimo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!