Swift 5, Xcode 10
Xcode is logging a weird error that's only happening when I'm doing something really specific:
My app connects to an FTP server after clicking on the "login" button but if there's no internet connection, it displays a dialog with two options: 1. Switch to offline mode, 2. Retry. If I pick "retry", connect the device to the internet, then hit the "login" button again, this error is thrown. If I switch to offline mode or if there's already an internet connection before I hit the "login" button, there's no error message.
Everything works just fine afterwards but I'd still like to get rid of it - if possible:
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 The only dictionary I'm using (afaik) is Bundle.main.infoDictionary?["CFBundleShortVersionString"] to display the version number but the error is logged even without this line of code. I'm also using the built in JSON parser (with Codable) but an error like that would be logged as a custom error message (which this one clearly isn't).
What does this error mean and how do I fix it?
I know that you can set up automatic break points that point you to the more or less exact line of code that's causing an error but what symbol/condition would I need to add one for this?
let reachability = Reachability()!, 2nd line:if reachability.connection != .none {....} else {...}. Removing the 2nd line also gets rid of the error. Are you using this class too?