lo-cafe / winston

A beautiful and native Reddit client for iOS
https://winston.cafe/
GNU General Public License v3.0
894 stars 63 forks source link

[Bug] JSON issue, loading any data from Reddit not possible #208

Open winnybot opened 10 months ago

winnybot commented 10 months ago

Describe the bug Alamofire.AFError.responseSerializationFailed(reason: Alamofire.AFError.ResponseSerializationFailureReason.decodingFailed(error: Swift.DecodingError.dataCorrupted(Swift.DecodingError.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.})))))

To Reproduce Steps to reproduce the behavior:

  1. Open the app
  2. reload

Expected behavior loading my subreddits and stuff

Device (please complete the following information): iPhone 15 Pro iOS 17.0.3

Flatric commented 10 months ago

Was able to find the reason for the issue: When setting up the app, after giving Winston permission to use the Reddit API Key (the screen where it shows "open winston" or "go to winston" afterward I don't remember exactly) it will start the app and show an "everything set up" screen. If the app crashes at that point and will be started manually afterward, the issue like I described above will show up. If the app doesn't crash at that point, everything will be set up correctly and there are no issues.

In my case, the app crashed at that point because my Pi-Hole prevented it from loading something, so it never reached the "everything set up" screen. After starting the app again it didn't try to load again whatever it tried loading before (even without Pi-Hole), so it seems like the set-up process wasn't finished, but winston doesn't realize that the setup process was not finished completely, so the error occurs.

frostplexx commented 10 months ago

Yeah Winston currently doesn't actually check if the API key actually works or is set correctly and it will always say that everything is working. This is definitely something we should fix @Kinark.