Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Displaying Data with Table Views in Swift 2 Displaying Data in Table Views Taking the Client for a Spin

Jonathan Law
seal-mask
.a{fill-rule:evenodd;}techdegree
Jonathan Law
iOS Development Techdegree Student 6,824 Points

Restaurant Finder app problems in "taking the client for a ride" module. Foursquare API returning errors, not data.

Can't understand what the issue is here. Compiler not showing any errors and the "build" is succeeding. Checked the connection to Foursquare API in previous modules and there was no problem. Instead of data appearing in console (or in table view of simulator), however, I am getting this (in the console):

2016-10-10 19:33:20.167697 RestaurantFinder[51836:743812] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0 2016-10-10 19:33:20.618330 RestaurantFinder[51836:743812] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0 2016-10-10 19:33:20.881048 RestaurantFinder[51836:743792] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0 2016-10-10 19:33:21.214895 RestaurantFinder[51836:743541] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0,

-- and so on and so on....

Any thoughts?

4 Answers

David Lin
David Lin
35,864 Points

I was just working on the restaurant app myself, and I got restaurant data back ok. So, maybe double-check your API, coordinate, client-key, secret-key, etc. to make sure there's no typo's or anything.

Jonathan Law
seal-mask
.a{fill-rule:evenodd;}techdegree
Jonathan Law
iOS Development Techdegree Student 6,824 Points

Thanks. Still not going through... errors seem a little different each time. Here is end of current one in case that gives someone a clue:


RestaurantFinder[58784:885008] [] __nw_socket_service_writes_block_invoke sendmsg(fd 9, 31 bytes): socket has been closed 2016-10-11 14:02:58.209846 RestaurantFinder[58784:885008] [] nw_endpoint_flow_protocol_error [1.1 104.156.81.184:443 cancelled socket-flow (null)] Socket protocol sent error: [32] Broken pipe 2016-10-11 14:02:58.210256 RestaurantFinder[58784:885008] [] nw_endpoint_flow_protocol_disconnected [1.1 104.156.81.184:443 cancelled socket-flow (null)] Output protocol disconnected 2016-10-11 14:02:58.210550 RestaurantFinder[58784:885008] [] nw_endpoint_handler_cancel [1.2 104.156.85.184:443 initial path (null)] 2016-10-11 14:02:58.210962 RestaurantFinder[58784:885008] [] nw_endpoint_handler_cancel [1.3 23.235.33.184:443 initial path (null)] 2016-10-11 14:02:58.211348 RestaurantFinder[58784:885008] [] nw_endpoint_handler_cancel [1.4 23.235.37.184:443 initial path (null)] 2016-10-11 14:02:58.211761 RestaurantFinder[58784:885008] [] nw_resolver_cancel_on_queue 0x60800010f540 2016-10-11 14:02:58.212151 RestaurantFinder[58784:885008] [] -[NWConcrete_tcp_connection dealloc] 1

Whatever that is... it's way beyond my knowledge [broken pipe?]. Not sure what to do: clientID and secret were copy/pasted and, as I mentioned earlier, there are no compiler errors. Several chapters back when we did the basic check-in with API the API showed that it had been reached, etc.

David Lin
David Lin
35,864 Points

Hard to debug it this way. If you want to post your code to GitHub and post the link to your repo here, I can help troubleshoot it with you.

Jonathan Law
seal-mask
.a{fill-rule:evenodd;}techdegree
Jonathan Law
iOS Development Techdegree Student 6,824 Points

I see in the midst of all those errors an HTTP "400" response which would indicate a "bad request" and probably some kind of syntax error in there somewhere...

My error was i didn't added the query components to the request on the API Client