|
Hello everyone! I have been working on my code for a while trying to figure out an issue and cant find anything. I even checked it with other people I know who have compleated the course to see what solution they found. Despite my code being identical excpet for a few names it still wont work. Firstly I continously find that I am only getting about half the amount of data (I'm getting 5399 Bytes) as my friends. In addition my code wont return any data to my array of structs. When trying to debug my code I found an error message that says "Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected character '<' around line 1, column 1." UserInfo={NSJSONSerializationErrorIndex=0, NSDebugDescription=Unexpected character '<' around line 1, column 1.}))". Since I am relativly new I dont know what that means. Please if you know anything let me know. My code will be attached below. Thank you for the help.
|
|
I have run the code (copy & paste to a new project) and get no errors. Just of couple of things that would change.
|
|
Also, this:
is completely unnecessary. The
|
|
Thank you for the suggustions. I tried both however neither of them ended up fixing my problem. I did however getting slightly more data (5424 Bytes) when I tried your sugguations but it still gives me the same error message and wont update my users array. |
|
Is the above the whole of your code? Because, like Nigel I get no errors when I copy/paste your code into a new project. So I'm thinking there might be something else in your project interfering. You could also try copy/pasting just the code you have posted here into a new project and see what happens. The error message is especially interesting.
This indicates that whatever data you are passing to the |
|
I tried creating a new project and it worked just fine. I'm extreamly unclear on what the problem could have been because as far as I'm aware I did nothing diffrent in this project than my old one. Anyways thank you both for the help! |
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!
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.