|
I was trying to adapt the example from day 49 to work with the data from Day 60. The code below did not work and I am stumped as to why it failed. This is just a quick ContentView to test it. I peaked ahead to the HWS+ solution for this and loadData() works. He defined the Decoder first I think so he could set the Date conversion... but short of that, why does the code below not work? It just displays nothing when I run it:
|
|
Hi! Just modify your
|
|
So was it failing due to the lack of the date code? I was not even displaying date, so I didnt put it in there. Also, the Day 49 code does not create the decoder first... so I am guessing you have to in order for it to work due to the date? |
SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
Yes, you're not displaying the date, however your struct Result contains that property. Once you get the data from the server, decoder still tries to decode but cannot decode that property. As for decoder instantiating before, you need to access .dateDecodingStrategy so that's why you can create it prior, set it up and then use that ready-to-use decoder later in the code. |
|
There are actually two mismatches. Try to use this code to see the error prints.
You'll see this error printed to console:
Once you change it to:
This tells that you cannot decode Date
Using Hope this is more clear now. |
|
ooops I didnt see your comment, I see what is going on... Result vs Response.... one of my bad habits of getting confused on name. This helped immensely @ygeras. Thank you so much! |
|
This is but one example of why it's best to use more descriptive names than (Not to mention that Swift has a built-in |
|
@roosterboy, I might be wrong, but I think Paul used Result in the one example as that is what the Itunes JSON returned... an array starting with [Result @ygeras, thank you, I am going to study what you typed above! Thank you to both of you :D |
|
After downloading some spy app which none worked on my cell phone, I almost gave up on finding out why my spouse keeps late at night and also receives calls at odd hours. Someone recommended a professional hacker team so I thought I should give it a trial. OMG! It worked like magic! To cut the long story short, all thanks to hackerspytech at gmail com this pro hacked into my spouse cell phone. Now I read all text messages without my spouse knowing about it. I also listen to all phone calls now. Thanks I highly recommend their service |
|
Granite4Less has been proudly serving Montreal and surrounding areas for years, with over 25 years of combined experience. Granite 4 less is a family company focused on quality and know-how. |
|
I know and can recommend a very efficient and trustworthy hacker. I got his email address on Quora , he is a very nice and he has helped me a couple of times even helped clear some discrepancies in my account at a very affordable price. he offers a top notch service and I am really glad I contacted him. He's the right person you need to talk to if you want to retrieve your deleted/old texts,call logs,emails,photos and also hack any of your spouse’s social network account facebook,instagram,telegram, tiktok,messenger chat,snapchat and whatsapp, He offers a legit and wide range of hacking services. His charges are affordable and reliable, This is my way of showing appreciation for a job well done. contact him for help via address below.. Email : urbanghosthacker @ gm ail co m |
SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.