You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 25, 2023. It is now read-only.
off-by-one bug with fetched markers URL 404'ing #143
Styles created with Mapbox Studio can't have markers, so their markers.geojson / features.json always 404 rather than return an empty collection. This creates an off-by-one bug in the offline downloading code.
We need to refactor so that the markers (and possibly subsequent marker icon) URL fetches only happen if the metadata says so.
@bleege I'm curious if you have any bandwidth to dig into this as I'm quite a bit tied up with #132. I can give you the scoop, but I think it could be relatively lightweight — changing MBXOfflineMapDownloader.m to only download the markers metadata if it's specified in a map's TileJSON. I can brain dump where I'm at with the problem.
1. check url string suffix before attempting to parse tile/feature json? else the majority of the time is trying to json-parse images
2. abstract sql write routines a bit for reuse?
Testing on new simulator worked for tiles, but didn't grab the markers (see error below). Will investigate.
2015-01-22 10:09:43.820 MBXMapKit[34480:613] Failed to load markers for map ID examples.map-pgygbwdm - (Error Domain=MBXMapKitErrorDomain Code=-4 "No offline data for key error" UserInfo=0x7fbd38f40240 {NSLocalizedDescription=No offline data for key error, NSLocalizedFailureReason=The offline database has no data for https://a.tiles.mapbox.com/v3/examples.map-pgygbwdm/markers.geojson})
Also discovered issue with locked database causing the download to not complete.
2015-01-22 10:17:42.862 MBXMapKit[34528:613] The offline map downloader encountered an sqlite error: Error Domain=MBXMapKitErrorDomain Code=-5 "Failed to execute query" UserInfo=0x7f9240d9a9a0 {NSLocalizedDescription=Failed to execute query, NSLocalizedFailureReason=There was an sqlite error while executing a query on database /Users/brad/Library/Developer/CoreSimulator/Devices/278DDFD6-92FC-4BC1-8EE6-1AC085E0A42D/data/Applications/1DAD772F-BC1A-470D-9965-F9235AEAB703/Library/Application Support/MBXMapKit/OfflineMaps/newdatabase.partial: database is locked}
Things looking pretty good @bleege as of d1f8f8f; I'll try to run things a bit tomorrow, but overall scan looks nice. Also: learned all about volatile today; surprised I've never come across it before!
Sounds good. I hadn't used volatile in iOS either before yesterday. I totally agree with the author's feelings as I had the same gnawing vibe while working on it: :-)
"As a general guideline, if you're using volatile in your code then you're probably doing something wrong."
Activity
incanus commentedon Jan 21, 2015
@bleege I'm curious if you have any bandwidth to dig into this as I'm quite a bit tied up with #132. I can give you the scoop, but I think it could be relatively lightweight — changing
MBXOfflineMapDownloader.mto only download the markers metadata if it's specified in a map's TileJSON. I can brain dump where I'm at with the problem.bleege commentedon Jan 21, 2015
@incanus Sure thing. Let me know when you're available to chat about this.
incanus commentedon Jan 21, 2015
@bleege Here's a list of four map ID's done two ways each (
v3/v4) and their respective conditions:https://gist.github.com/incanus/9276cc7f626821dc48af
It all basically comes down to parsing and obeying the TileJSON, I think.
/cc @willwhite
#143 - Refactoring to only request Marker data if it's been specified…
bleege commentedon Jan 21, 2015
Will Clean Up code a bit and then close issue:
#143 - Removing commented out code from initial refactor
#143 - Adding .DS_Store to .gitignore
#143 - Adding url parsing to downloaded content to minimize attempts…
#143 - Centralizing save resource urls to database logic
bleege commentedon Jan 22, 2015
Made the initial clean up changes, but need to do a bit more testing to make sure that things are behaving as they should.
BTW, this is now in the
offlineFetchbranch.bleege commentedon Jan 22, 2015
Testing on new simulator worked for tiles, but didn't grab the markers (see error below). Will investigate.
bleege commentedon Jan 22, 2015
Oh duh... the path extension test only tests for
.jsonfiles. This would be a problem for files with.geojsonextensions. :-)bleege commentedon Jan 22, 2015
Also discovered issue with locked database causing the download to not complete.
#143 - Refactored save urls to database to use sqlite data queue to …
12 remaining items
bleege commentedon Jan 23, 2015
Successfully tested save and reload on iOS 8 simulator!
#143 - Cleaning up some commented out code from the refactor
incanus commentedon Jan 23, 2015
Things looking pretty good @bleege as of d1f8f8f; I'll try to run things a bit tomorrow, but overall scan looks nice. Also: learned all about
volatiletoday; surprised I've never come across it before!bleege commentedon Jan 23, 2015
Sounds good. I hadn't used
volatilein iOS either before yesterday. I totally agree with the author's feelings as I had the same gnawing vibe while working on it: :-)#143 #147 - Code cleanup
#143 #147 - Better variable names
#143 #147 - Removing debug logging statements
refs #147: revert offline download change to keep work in feature branch