Skip to content
This repository was archived by the owner on Aug 25, 2023. It is now read-only.
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

Closed

Description

@incanus

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.

Activity

  1. incanus commented on Jan 21, 2015

    @incanus
    ContributorAuthor

    @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.

  2. bleege commented on Jan 21, 2015

    @bleege
    Contributor

    @incanus Sure thing. Let me know when you're available to chat about this.

  3. incanus commented on Jan 21, 2015

    @incanus
    ContributorAuthor

    @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

  4. added a commit that references this issue on Jan 21, 2015
  5. bleege commented on Jan 21, 2015

    @bleege
    Contributor

    Will Clean Up code a bit and then close issue:

    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?
    
  6. added 4 commits that reference this issue on Jan 22, 2015
  7. bleege commented on Jan 22, 2015

    @bleege
    Contributor

    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 offlineFetch branch.

  8. bleege commented on Jan 22, 2015

    @bleege
    Contributor

    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})
    
  9. bleege commented on Jan 22, 2015

    @bleege
    Contributor

    Oh duh... the path extension test only tests for .json files. This would be a problem for files with .geojson extensions. :-)

  10. bleege commented on Jan 22, 2015

    @bleege
    Contributor

    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}
    
  11. added a commit that references this issue on Jan 22, 2015
  12. 12 remaining items

  13. bleege commented on Jan 23, 2015

    @bleege
    Contributor

    Successfully tested save and reload on iOS 8 simulator!

  14. added a commit that references this issue on Jan 23, 2015
  15. modified the milestone: 0.6.0 on Jan 23, 2015
  16. incanus commented on Jan 23, 2015

    @incanus
    ContributorAuthor

    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!

  17. bleege commented on Jan 23, 2015

    @bleege
    Contributor

    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."

  18. added 3 commits that reference this issue on Feb 3, 2015
  19. modified the milestones: 0.6.0, on Feb 4, 2015
  20. added a commit that references this issue on Feb 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions