Bug 40299 - MapBox SDK 4.0 - Cannot cast TilePyramidOfflineRegion to OfflineRegion when using OfflineStorage.Shared.AddPack method
Summary: MapBox SDK 4.0 - Cannot cast TilePyramidOfflineRegion to OfflineRegion when u...
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jon Dick
Depends on:
Reported: 2016-04-12 11:56 UTC by yves.ducreuzet
Modified: 2017-09-28 14:35 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description yves.ducreuzet 2016-04-12 11:56:10 UTC
Trying to implement the Offline Map functionalities. The implementation doesn't look complete/functional.
I'm using as reference the tutorial on the MApBox website about Offline maps.

i'm creating an instance of TilePyramidOfflineRegion like this

var offlineRegion = new TilePyramidOfflineRegion (map.StyleURL, map.VisibleCoordinateBounds, 17, 19);

Then later i want to cache this region as explained on the Mapbox website (for objc/swift)

OfflineStorage.Shared.AddPack(offlineRegion, context, (pack, error)=> {
    Console.WriteLine ("map cached");

The problem is i cannot convert TilePyramidOfflineRegion to OfflineRegion like it is done in the official tutorial.
Comment 1 Jon Dick 2016-05-10 14:55:56 UTC
Looks like the signature of AddPack was expecting the OfflineRegion class instead of the IOfflineRegion interface (protocol) which both OfflineRegion and TilePyramidOfflineRegion implement.

This should be fixed in the next release.