Recently, Xamarin released major updates to its iOS and Forms platforms in order to support 32/64-bit architectures from a Unified API.
These updates came across as Stable Channel updates in Xamarin Studio (or Visual Studio) which included version 8.6 of the Xamarin.iOS platform.
Suddenly, our existing Xamarin.Forms iOS app started crashing at runtime with an error similar to the one below:
Unable to cast object of type 'Xamarin.Forms.Platform.iOS.ActivityIndicatorRenderer' (Objective-C type: 'Xamarin_Forms_Platform_iOS_ActivityIndicatorRenderer') to type 'Xamarin.Forms.Platform.iOS.ViewRenderer`2'.
Additional information:
Selector: layoutSubviews
Method: Xamarin.Forms.Platform.iOS.ViewRenderer`2:LayoutSubviews ()
Why?
Turns out, a configuration that we set months ago to remedy an issue with some 3rd party libraries was both no longer necessary and was causing a conflict with the new Xamarin.iOS release.
Read more about Type Registrar on Xamarin.iOS
The important bit for us was to remove
<MtouchExtraArgs>--registrar:legacy</MtouchExtraArgs>
from the iOS project file. This can be done by manually editing the .csproj file or in the IDE by editing the
iOS Build Options > Advanced > Additional mtouch arguments
.