Xamarin.iOS

XamRight warns about some possible errors in native Xamarin.iOS code.

[XR5801, XR5802] AddObserver (KVO) on wrong property name

When using Key Value Observing in Xamarin.iOS (NSObject.AddObserver), the name of the property to observe has to match the name of the exported getter on the property. Trying to observe a property that doesn’t exist will result in a warning:

[XR5803] Incorrect calls to set TableView CellReuse

iOS 6 introduced a pattern for cell reuse as described here – https://docs.microsoft.com/en-us/xamarin/ios/user-interface/controls/tables/populating-a-table-with-data#cell-reuse-in-ios-6. If the call to TableView.RegisterClassForCellReuse is used with a custom cell, the custom cell class needs to implement the constructor that takes IntPtr as an argument. Accordingly, XamRight checks and warns if the custom cell used for the TableView uses the wrong constructor.



Author