Every time I run my switf app in the iOS Simulator, it crashes immediately with this:
0x1082c1620: pushq %rbp
0x1082c1621: movq %rsp, %rbp
0x1082c1624: pushq %rbx
0x1082c1625: pushq %rax
0x1082c1626: movq %rsi, %rcx
0x1082c1629: movq %rdi, %rbx
0x1082c162c: xorl %eax, %eax
0x1082c162e: testq %rbx, %rbx
0x1082c1631: je 0x1082c164c ; swift_dynamicCastObjCClassUnconditional + 44
0x1082c1633: movq 0x82756(%rip), %rsi ; "isKindOfClass:"
0x1082c163a: movq %rbx, %rdi
0x1082c163d: movq %rcx, %rdx
0x1082c1640: callq 0x1082c41ca ; symbol stub for: objc_msgSend
0x1082c1645: testb %al, %al
0x1082c1647: movq %rbx, %rax
0x1082c164a: je 0x1082c1653 ; swift_dynamicCastObjCClassUnconditional + 51
0x1082c164c: addq $0x8, %rsp
0x1082c1650: popq %rbx
0x1082c1651: popq %rbp
0x1082c1653: leaq 0xcdc8(%rip), %rax ; "Swift dynamic cast failed"
0x1082c165a: movq %rax, 0x8ae57(%rip) ; gCRAnnotations + 8
0x1082c1662: nopw %cs:(%rax,%rax)
highlighting the last line telling me EXC_BREAKPOINT(code=EXC_i386_BPT, subcode=0x0) error with no description before it gave me the exact same issue but it told me that 'localizable string has failed to load' referring to the storyboard. Although now it doesn't tell me anything only (lldb). I was wondering if this could have something to do with the storyboard as well. Please help
Best How To :
The crucial fact here is that the last instruction you executed before stopping is "int3". The int3 instruction is used both by the debugger - it is what the debugger inserts into your code to implement breakpoints - AND it is used by some system libraries, including the Swift standard library, to implement "assert into the debugger" when some fatal error has occurred. The way you can distinguish the two uses is that, if the "int3" were inserted by the debugger, it would not show you that int3 instruction in the disassembly, it would show you the original instruction it was replacing. Also if it were one of ours, lldb would not report EXC_BREAKPOINT as the stop reason, it would tell you which breakpoint you had hit. So this has to be a library assert.
Without more context I can't tell for sure what is going on, but it looks like the swift standard library asserting because somebody tried to cast some swift object that is backed by an ObjC object to some type that it can't be cast to.
I'd look up on the stack above the point of this crash and see if you can see anything of this sort. You said you have been having problems with your storyboards. If the code that is calling down into this assert looks like it has to do with internalizing storyboards, then maybe there is something wrong with those in your project, the deserializer in IB read some junk instead of the desired object, and the first point of failure for that is the data can't be cast to something reasonable. This is not an area I know all that much about, but, looking at the stack listing when you crash and trying to figure out what the program was doing that would lead to a casting error seems to me the most promising next step in your investigation.