NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) StoreSearch Apprentice book

I’m up to page 73 in the StoreSeach Apprentice book. When I try and run I get the following error: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

This seems totally random, as I was able to get results before, even when I run the app in the 03 -Using Web Service folder it fails so I know it’s not a typo.

If I run the query in Safari, it returns results…

here is the some of the error:

2016-10-04 13:33:08.744009 StoreSearch[6259:1208685] [] nw_endpoint_flow_attach_protocols [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)] Attached flow protocol
2016-10-04 13:33:08.744168 StoreSearch[6259:1208685] [] nw_endpoint_resolver_receive_report [1 itunes.apple.com:443 in_progress resolver (satisfied)] received child report:[1.1 184.25.66.217:443 in_progress socket-flow (satisfied)]
2016-10-04 13:33:08.744330 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)] reported event flow:start_connect
2016-10-04 13:33:08.746430 StoreSearch[6259:1208685] [] nw_socket_handle_socket_event Event mask: 0x800
2016-10-04 13:33:08.746628 StoreSearch[6259:1208685] [] nw_socket_handle_socket_event Socket received CONNECTED event
2016-10-04 13:33:08.746814 StoreSearch[6259:1208685] [] nw_socket_setup_notsent_lowat Set TCP_NOTSENT_LOWAT(16384)
2016-10-04 13:33:08.747077 StoreSearch[6259:1208685] [] nw_endpoint_flow_protocol_connected [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)] Output protocol connected
2016-10-04 13:33:08.747620 StoreSearch[6259:1208685] [] nw_endpoint_flow_connected_path_change [1.1 184.25.66.217:443 ready socket-flow (satisfied)]
2016-10-04 13:33:08.747797 StoreSearch[6259:1208685] [] nw_endpoint_flow_connected_path_change [1.1 184.25.66.217:443 ready socket-flow (satisfied)] Connected path is satisfied
2016-10-04 13:33:08.747968 StoreSearch[6259:1208685] [] nw_endpoint_resolver_receive_report [1 itunes.apple.com:443 in_progress resolver (satisfied)] received child report:[1.1 184.25.66.217:443 ready socket-flow (satisfied)]
2016-10-04 13:33:08.748178 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1.1 184.25.66.217:443 ready socket-flow (satisfied)] reported event flow:finish_connect
2016-10-04 13:33:08.748419 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1 itunes.apple.com:443 ready resolver (satisfied)] reported event flow:finish_connect
2016-10-04 13:33:08.748629 StoreSearch[6259:1208685] [] nw_endpoint_resolver_receive_report [1 itunes.apple.com:443 ready resolver (satisfied)] received child report:[1.1 184.25.66.217:443 ready socket-flow (satisfied)]
2016-10-04 13:33:08.748811 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1.1 184.25.66.217:443 ready socket-flow (satisfied)] reported event flow:changed_viability
2016-10-04 13:33:08.749026 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1 itunes.apple.com:443 ready resolver (satisfied)] reported event flow:changed_viability
2016-10-04 13:33:08.749284 StoreSearch[6259:1208704] [] __tcp_connection_start_block_invoke 1 sending event TCP_CONNECTION_EVENT_CONNECTED in response to state ready and error (null)
2016-10-04 13:33:08.749428 StoreSearch[6259:1208704] [] tcp_connection_event_notify 1 event: TCP_CONNECTION_EVENT_CONNECTED, reason: nw_connection event, should deliver: true
2016-10-04 13:33:08.750023 StoreSearch[6259:1208685] [] nw_endpoint_start_tls_while_connected [1.1 184.25.66.217:443 ready socket-flow (satisfied)]
2016-10-04 13:33:08.750198 StoreSearch[6259:1208685] [] nw_endpoint_start_tls_while_connected [1.1 184.25.66.217:443 ready socket-flow (satisfied)] Using CoreTLS
2016-10-04 13:33:08.750595 StoreSearch[6259:1208685] [] nw_endpoint_start_tls_while_connected [1.1 184.25.66.217:443 ready socket-flow (satisfied)] Set custom TLS client queue
2016-10-04 13:33:08.750734 StoreSearch[6259:1208685] [] nw_endpoint_start_tls_while_connected [1.1 184.25.66.217:443 ready socket-flow (satisfied)] Set custom TLS prepare handler
2016-10-04 13:33:08.750878 StoreSearch[6259:1208685] [] nw_endpoint_start_tls_while_connected [1.1 184.25.66.217:443 ready socket-flow (satisfied)] Set custom TLS message handler
2016-10-04 13:33:08.751039 StoreSearch[6259:1208685] [] nw_endpoint_start_tls_while_connected [1.1 184.25.66.217:443 ready socket-flow (satisfied)] Attached TLS protocol to connected flow
2016-10-04 13:33:08.751231 StoreSearch[6259:1208685] [] nw_endpoint_resolver_receive_report [1 itunes.apple.com:443 ready resolver (satisfied)] received child report:[1.1 184.25.66.217:443 in_progress socket-flow (satisfied)]
2016-10-04 13:33:08.751393 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)] reported event flow:start_secondary_connect
2016-10-04 13:33:08.751568 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1 itunes.apple.com:443 in_progress resolver (satisfied)] reported event flow:start_secondary_connect
2016-10-04 13:33:08.751733 StoreSearch[6259:1208685] [] nw_endpoint_resolver_receive_report [1 itunes.apple.com:443 in_progress resolver (satisfied)] received child report:[1.1 184.25.66.217:443 in_progress socket-flow (satisfied)]
2016-10-04 13:33:08.751885 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)] reported event flow:start_connect
2016-10-04 13:33:08.752035 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1 itunes.apple.com:443 in_progress resolver (satisfied)] reported event flow:start_connect
2016-10-04 13:33:08.752190 StoreSearch[6259:1208685] [] nw_endpoint_flow_protocol_connected [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)] Transport protocol connected
2016-10-04 13:33:08.752353 StoreSearch[6259:1208685] [] nw_endpoint_resolver_receive_report [1 itunes.apple.com:443 in_progress resolver (satisfied)] received child report:[1.1 184.25.66.217:443 in_progress socket-flow (satisfied)]
2016-10-04 13:33:08.752565 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)] reported event flow:finish_transport
2016-10-04 13:33:08.752729 StoreSearch[6259:1208685] [] nw_connection_endpoint_report [1 itunes.apple.com:443 in_progress resolver (satisfied)] reported event flow:finish_transport
2016-10-04 13:33:08.768102 StoreSearch[6259:1208685] subsystem: com.apple.securityd, category: SecError, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0
2016-10-04 13:33:08.770509 StoreSearch[6259:1208685] [] tcp_connection_cancel 1
2016-10-04 13:33:08.770775 StoreSearch[6259:1208704] [] nw_endpoint_handler_cancel [1 itunes.apple.com:443 in_progress resolver (satisfied)]
2016-10-04 13:33:08.770 StoreSearch[6259:1209008] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2016-10-04 13:33:08.771076 StoreSearch[6259:1208704] [] nw_endpoint_handler_cancel [1.1 184.25.66.217:443 in_progress socket-flow (satisfied)]
2016-10-04 13:33:08.771330 StoreSearch[6259:1208704] [] nw_endpoint_flow_protocol_disconnected [1.1 184.25.66.217:443 cancelled socket-flow (null)] Output protocol disconnected
2016-10-04 13:33:08.771778 StoreSearch[6259:1208704] [] nw_resolver_cancel_on_queue 0x60800010b760
2016-10-04 13:33:08.772015 StoreSearch[6259:1208704] [] -[NWConcrete_tcp_connection dealloc] 1
Download Error: Error Domain=NSCocoaErrorDomain Code=256 “The file “search” couldn’t be opened.” UserInfo={NSURL=https://itunes.apple.com/search?term=Apple}

All that other stuff in the output is not important. The actual error message is here:

For some reason, your app fails to open the iTunes URL. However, I just copy-pasted that same URL into Safari on my Mac and it works fine there. What happens when you copy-paste that URL into a browser or your Mac?