|
Hello, I've gone through the first day of Project 7 and when I build the app, it doesn't show any parsed data (title or body) in the Table View Controller. In the debug window I get the following message:
I've also downloaded the project from the HWS Github page to make sure it wasn't something I messed up while following the tutorial, and I get the same result when trying to build; no data showing up, and same error message. Any suggestions for next steps? Thanks! Xcode 12.4 |
|
|
|
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today! Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
|
|
Thanks plrichardson - yes, same outcome whether I use the cached HWS url or the real whitehouse feed. |
|
Pretty sure that error is something you can ignore. It started popping up with Xcode 12 and doesn't prevent apps from running. Not sure why you can't get even Paul's project to work. My version of Project 7 works once I swap out the hackingwithswift.com URL for the non-functioning whitehouse.gov one. And if I download Paul's github repository and run that project, it also works after swapping out the URL. Maybe post your |
|
Thanks @roosterboy - sorry for the delay. Because Paul's project has the same result, I'm also stumped on this one. Here's my ViewController.swift code though in case that does help:
|
|
Interesting... If I replace the All I can think is that maybe the URL is being blocked on your system somehow? What happens if try to go to the JSON's URL in a browser window? |
|
Thanks for checking the file - when I go to the json feed in a browser it shows up correctly. I also disabled my VPN (which has some blocking as well), just to make sure, and I'm still getting the same result. hmmm.... |
|
|
|
Hello guys, I had exactly the same issue, and managed to solve it. First, looks like the whitehouse API is not working anymore,so the following domains(or any related to the API itself) will not work : https://api.whitehouse.gov/v1/petitions.json?limit=100 and https://api.whitehouse.gov/v1/petitions.json?signatureCountFloor=10000&limit=100 So we will need to use Pauls: https://www.hackingwithswift.com/samples/petitions-1.json and https://www.hackingwithswift.com/samples/petitions-2.json Second, the issue with no parsed data even with Pauls link was a silly typo from my side in the Petition object. I wrote var signatureCounter: Int instead of var signatureCount: Int . This why for example when @roosterboy replaced the ViewController it started working on his end. After fixing the typo, it all worked perfectly! So check carefully for any typos!!! Good luck guys and girls !
|
|
Yet another example of why one should not decode JSON like this:
but should instead use a
there would have been a |
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.