在实际设备上运行项目时,出现标题错误。有时,子代码会有所不同。我没有任何断点。我检查了。相信我。
Here are my files。启动时会发生此错误。
我该怎么做才能解决此问题?提前致谢!
编辑:fatal error: unexpectedly found nil while unwrapping an Optional value
打印到控制台。
最佳答案
我认为错误在于这部分:
let dir = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true).first
let filePath = NSURL(fileURLWithPath: dir!).URLByAppendingPathComponent("file.txt")
它被迫解开“ dir”,在您的实际设备上,这种情况下可能不可用。这会导致立即崩溃。
关于ios - Xcode错误线程1:EXC_BREAKPOINT(代码= 1,子代码= 0x1001f276588),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37555837/