Swift 5,Xcode 10
Xcode记录了一个奇怪的错误,该错误仅在我做一些非常具体的事情时才会发生:
我的应用程序在单击“登录”按钮后连接到FTP服务器,但是如果没有Internet连接,它将显示一个带有两个选项的对话框:1.切换到离线模式,2.重试。如果我选择“重试”,将设备连接到互联网,然后再次单击“登录”按钮,则会引发此错误。如果我切换到离线模式,或者在单击“登录”按钮之前已经存在互联网连接,则不会显示错误消息。
事后一切正常,但我仍然想摆脱它-如果可能的话:
2019-07-10 16:43:18.233414+0200 myapp[5256:111188] [] nw_dictionary_copy called with null dictionary
2019-07-10 16:43:18.235183+0200 myapp[5256:111188] [] __nwlog_err_simulate_crash simulate crash failed "nw_dictionary_copy called with null dictionary"
2019-07-10 16:43:18.237115+0200 myapp[5256:111188] [] nw_dictionary_copy called with null dictionary, dumping backtrace:
[x86_64] libnetcore-1229.250.15
0 libnetwork.dylib 0x000000010c35c3b8 __nw_create_backtrace_string + 120
1 libnetwork.dylib 0x000000010c2b74e3 nw_dictionary_copy + 643
2 libnetwork.dylib 0x000000010c2fffe8 __nw_path_watch_simulator_network_changes_block_invoke + 40
3 libsystem_notify.dylib 0x00000001090429b3 notify_register_mach_port + 7676
4 libdispatch.dylib 0x0000000108d82725 _dispatch_block_async_invoke2 + 83
5 libdispatch.dylib 0x0000000108d74db5 _dispatch_client_callout + 8
6 libdispatch.dylib 0x0000000108d7e792 _dispatch_workloop_invoke + 3251
7 libdispatch.dylib 0x0000000108d86ea3 _dispatch_workloop_worker_thread + 733
8 libsystem_pthread.dylib 0x000000010915d611 _pthread_wqthread + 421
9 libsystem_pthread.dylib 0x000000010915d3fd start_wqthread + 13
2019-07-10 16:43:18.241412+0200 myapp[5256:111188] [] nw_dictionary_apply called with null dictionary
2019-07-10 16:43:18.241561+0200 myapp[5256:111188] [] __nwlog_err_simulate_crash simulate crash failed "nw_dictionary_apply called with null dictionary"
2019-07-10 16:43:18.241923+0200 myapp[5256:111188] [] nw_dictionary_apply called with null dictionary, dumping backtrace:
[x86_64] libnetcore-1229.250.15
0 libnetwork.dylib 0x000000010c35c3b8 __nw_create_backtrace_string + 120
1 libnetwork.dylib 0x000000010c2b6bf9 nw_dictionary_apply + 249
2 libnetwork.dylib 0x000000010c300002 __nw_path_watch_simulator_network_changes_block_invoke + 66
3 libsystem_notify.dylib 0x00000001090429b3 notify_register_mach_port + 7676
4 libdispatch.dylib 0x0000000108d82725 _dispatch_block_async_invoke2 + 83
5 libdispatch.dylib 0x0000000108d74db5 _dispatch_client_callout + 8
6 libdispatch.dylib 0x0000000108d7e792 _dispatch_workloop_invoke + 3251
7 libdispatch.dylib 0x0000000108d86ea3 _dispatch_workloop_worker_thread + 733
8 libsystem_pthread.dylib 0x000000010915d611 _pthread_wqthread + 421
9 libsystem_pthread.dylib 0x000000010915d3fd start_wqthread + 13
我正在使用的唯一字典(afaik)是Bundle.main.infoDictionary?["CFBundleShortVersionString"]
,用于显示版本号,但是即使没有这一行代码,也会记录错误。我还使用了内置的JSON解析器(带有Codable
),但类似的错误将记录为自定义错误消息(显然不是)。
此错误是什么意思,我该如何解决?
我知道您可以设置自动断点,将其指向导致错误的或多或少准确的代码行,但是我需要为此添加什么符号/条件?