|
I just copy all the code from this course and try to run it, but it always print 'Unable to load saved data.' at the begining. For debug, I added some prints like this:
After that, it can print 'Saved data' and 'get data', but it always print "Unable to load saved data." For the CodableMKPointAnnotation:
So, how can I fix the problem? |
|
Sorry, no real solution from my side. I do have the same problem here... It seems that the document directory has always a different app container as part of the URL and therefore the file cannot be found when the app is restarted. First run: file:///Users/philipp/Library/Developer/CoreSimulator/Devices/818683A7-14FE-4823-8D3D-A1A36F233E92/data/Containers/Data/Application/FF1F169F-FD18-4377-9372-53F790666E07/Documents/ Next run: file:///Users/philipp/Library/Developer/CoreSimulator/Devices/818683A7-14FE-4823-8D3D-A1A36F233E92/data/Containers/Data/Application/D9718266-6B7D-460D-BDDD-12BE9A8BB4E6/Documents/ => It seems that everytime the app is restarted from Xcode, it is reinstalled and therefore gets a fresh container. But this is going to erase the document!?! This is not how I would expect it to work... even updating the App should never erase the content in the Documents directory |
|
Ohhh... I found the issue and it is not related to Xcode :-) The problem appears if you add a location without modifying the title and subtitle (=you keep the placeholder value If you checkout the There are various solutions to fix this:
|
|
Yet another solution is to give subtitle a default value. Simply add one line
to the plus Button in ContentView. |
|
Yes! Thanks a lot people, I was trying to debug this and I was nowhere near the solution. Onwards to the challenges! |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
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.