question

StevenBrydon-8196 avatar image
1 Vote"
StevenBrydon-8196 asked adolfo1981 edited

AppCenter Start is crashing in Xamarin forms app build and deployed to connected iPhone

I call AppCenter.Start in my app's OnStart method. This works fine if I build and deploy to an iOS simulator BUT if I build and deploy to a connected iPhone I get the following crash on start up:

[0:] An error occurred: 'Could not create an native instance of the type 'Microsoft.AppCenter.iOS.Bindings.MSACWrapperSdk': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: ' at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0002e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:247
at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:147
at Microsoft.AppCenter.iOS.Bindings.MSACWrapperSdk..ctor (System.String wrapperSdkVersion, System.String wrapperSdkName, System.String >wrapperRuntimeVersion, System.String liveUpdateReleaseLabel, System.String liveUpdateDeploymentKey, System.String liveUpdatePackageHash) <0x114830990 + >0x0000a> in <ec0f0f70541d48dcbe5905e6d8ddf187>:0
at Microsoft.AppCenter.AppCenter.SetWrapperSdk () <0x11482ff58 + 0x00012> in <e3f0b909e1aa4c5e99f60c97981cd946>:0
at Microsoft.AppCenter.AppCenter.PlatformStart (System.String appSecret, System.Type[] services) <0x11482fc70 + 0x00002> in ><e3f0b909e1aa4c5e99f60c97981cd946>:0
at Microsoft.AppCenter.AppCenter.Start (System.String appSecret, System.Type[] services) <0x11482f768 + 0x00008> in <e3f0b909e1aa4c5e99f60c97981cd946>:0

Using Visual Studio Professional 2019 16.11




dotnet-xamarinformsdotnet-ios
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@StevenBrydon-8196 First, make sure provisioning profiles added and the app can be deployed to your device normally without using App Center. About provisioning, you can refer to Device provisioning for Xamarin.iOS. Also, when using App Center, iOS 9.0 or later is required. If the app deployed sucessfully but failed using App Center, you can get the help here: Help and feedback.

0 Votes 0 ·

I have the same issue after upgrading to VS 2019 16.11. Using iOS 14.7.1. I removed my account for automatic provisioning profiles and added it back. Same issue. Appreciate your help if you've resolved this problem

0 Votes 0 ·

No feedback from anyone as yet? This issue is quite crippling. We literally cannot release and launch our app because of this, and it has been 2 weeks plus now.

0 Votes 0 ·

1 Answer

adolfo1981 avatar image
0 Votes"
adolfo1981 answered adolfo1981 edited

I had similar error while upgrading VS to version 16.11.3 and I was able to get passed this by following this: https://stackoverflow.com/questions/32999376/how-do-i-set-monotouch-objcruntime-class-throwoninitfailure-to-false

I added this line to my AppDelegate.cs FinishedLaunching method:

 ObjCRuntime.Class.ThrowOnInitFailure = false;

I know this is not solving the root cause but at least my app is not crashing anymore.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.