Xamarin-macios: Add null allowing to `MKAnnotationView` ctor parameters

Created on 4 Jan 2019  路  5Comments  路  Source: xamarin/xamarin-macios

Steps to Reproduce

  1. Download a sample
  2. Open and run it

You can find the original sample here. As you can find there - swift allows passing nil into the base (super) constructor.
Apple documentation for this constructor is here.

Expected Behavior

It doesn't crush

Actual Behavior

It crashes with ANE on CustomAnnotationView creation step.

Environment

  1. VSfM
    https://gist.github.com/mykyta-bondarenko-gl/4ae8c636f541a497619c8448ade6f437

Build Logs

  1. Build Log
    https://gist.github.com/mykyta-bondarenko-gl/48f224f3d1e422f863f7341b48dc09e5

Example Project

MapCallouts

bug iOS macOS

All 5 comments

The documentation does not mention it - but the headers do allow a null for the first (annotation) argument.

@mykyta-bondarenko-gl mmh according to https://github.com/xamarin/xamarin-macios/blob/master/src/mapkit.cs#L102-L106 it seems MKAnnotationView's constructor has the right [NullAllowed].

However MKPinAnnotationView's constructor seems incorrect (missing [NullAllowed]) https://github.com/xamarin/xamarin-macios/blob/master/src/mapkit.cs#L816-L821.

Note: @spouliot the documentation does mention it https://developer.apple.com/documentation/mapkit/mkannotationview/1452779-initwithannotation?language=objc

reuseIdentifier
If you plan to reuse the annotation view for similar types of annotations, pass a string to identify it. Although you can pass nil if you do not intend to reuse the view, reusing annotation views is generally recommended.

@VincentDondain [NullAllowed] should be for the first parameter too https://github.com/xamarin/xamarin-macios/blob/master/src/mapkit.cs#L102-L106

@VincentDondain you missed the first in my comment, the second argument is correct (I both docs and bindings)

@spouliot can we merge these changes into the d16-0 too?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sharmashiv picture sharmashiv  路  4Comments

rolfbjarne picture rolfbjarne  路  4Comments

wcoder picture wcoder  路  3Comments

ormaa picture ormaa  路  3Comments

nickmask picture nickmask  路  3Comments