Bug 40300 - MapBox SDK 4.0 - Cannot create a CustomCalloutView / Crash
Summary: MapBox SDK 4.0 - Cannot create a CustomCalloutView / Crash
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2016-04-12 11:58 UTC by yves.ducreuzet
Modified: 2017-09-28 14:33 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description yves.ducreuzet 2016-04-12 11:58:21 UTC
The documentation state that we should use the official MapBox website documentation to use the Xamarin SDK.
The implementation seems to be quite different from the original library.

I'm trying to extends the CalloutView base class but whatever i'm trying this is crashing the app.
Could you provide an example on how to use it ?
Comment 1 Eric Smith 2016-04-16 00:31:46 UTC
Experiencing the same crash as Yves when trying to instantiate a CalloutView sub-class:

critical:   at <unknown> <0xffffffff>
critical:   at (wrapper managed-to-native) ApiDefinition.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr) <IL 0x0002a, 0xffffffff>
critical:   at Mapbox.CalloutView..ctor () <IL 0x00067, 0x00183>
critical:   at EoT.MyCallout.ctor (TarkDrama.Actor) [0x00000]

Note that the MapBox SDK indicates that GetCalloutView implementation should return a UIView which implements the MGLCalloutView protocol.  In the Xamarin implementation, CalloutView is a class derived from NSObject, so it can't be a UIView.
Comment 2 Jon Dick 2016-05-10 14:45:41 UTC
As best I can tell, the CalloutView protocol derives from NSObject (according to the header files).  In the current binding, we don't generate an interface for CalloutView, so we should be generating ICalloutView which you could then implement in your own UIView subclass (eg: `public class MyCalloutView : UIView, ICalloutView` and then `GetCalloutView` should return `ICalloutView` (and there's a couple other methods that should use ICalloutView instead of CalloutView.

We will fix this in the next release.