mbxmapkit icon indicating copy to clipboard operation
mbxmapkit copied to clipboard

ios SDK issue

Open vinod1988 opened this issue 11 years ago • 2 comments

Hi i am implemented the sdk in my app, working fine but i got this error: When the map download state changed.

Error while reading offline map urls: Error Domain=MBXMapKitErrorDomain Code=-5 "Failed to execute query" UserInfo=0x79a6b020 {NSLocalizedFailureReason=There was an sqlite error while executing a query on database /Users/vinod/Library/Developer/CoreSimulator/Devices/3847BC57-C44D-457D-99D5-3249EABC2552/data/Containers/Data/Application/D2337F6C-F899-4115-A845-FC90C238B41A/Library/Application Support/MBXMapKit/OfflineMaps/newdatabase.partial: disk I/O error, NSLocalizedDescription=Failed to execute query}

2015-01-30 14:56:59.609 Agralogic[5443:288636] -[HomeViewController offlineMapDownloader:stateChangedTo:] [Line 903] MBXOfflineMapDownloaderStateRunning

Can any one help me. How can i solve this issue on my app. Thanks for help.

vinod1988 avatar Jan 30 '15 09:01 vinod1988

Hi @vinod1988,

You didn't mention which revision of MBXMapKit you're using (a specific tag, cocoapods, HEAD of master branch, etc), so for the links below, I'll use the 0.5.0 tag for master.

"Error while reading offline map urls:..." comes from startDownloading: in MBXOfflineMapDownloader.m at a point where it is attempting to read a list of urls from an sqlite database so that it can begin downloading them. The urls are supposed to be placed into the database by beginDownloadingMapID:....

The "Failed to execute query" part of the error message comes from the guts of MBXOfflineMapDownloader.m's sqlite code. My guess is that the sqlite code can find and read the database, but that the file is somehow corrupted or incorrectly initialized.

Things you could try:

  1. Find the sqlite file (.../OfflineMaps/newdatabase.partial), open it up with the sqlite3 command line shell, and see what's going on with the schema and the tables. Compare that to what you get from putting a breakpoint on beginDownloadingMapID:... and tracing through as it attempts to write urls into the database.
  2. It's possible that the problem is caused by a corrupt sqlite file. You could try doing a "Reset Content and Settings..." in the simulator, doing a clean build in Xcode, then running it again to see if the problem is repeatable.
  3. There's a possibility you're seeing a bug caused by MBXMapKit needing to catch up with changes in how the Mapbox API works, so you should probably take a look at issue #143 and the offlineFetch branch.

/cc @incanus @bleege

ghost avatar Feb 02 '15 20:02 ghost

It's possible that the problem is caused by a corrupt sqlite file. You could try doing a "Reset Content and Settings..." in the simulator, doing a clean build in Xcode, then running it again to see if the problem is repeatable.

This sounds mostly likely to me. @vinod1988 can you confirm with a fresh install?

incanus avatar Feb 03 '15 23:02 incanus