Xamarin App crashes after testFlight release before my code runs - xamarin.forms

Hello and thank you for reading.
This is my first time publishing an ios application and I am using Xamarin to publish my app to both Android and iOS (as requested by the client ).
Now the application deploys and works correctly when I run it via visual studio/Rider but when I push it to testflight (via azure pipeline and microsoft App Center) I get the following Crash report:
link to crashreport

oke so after some triel and error I have found the problem:
Apparently in Xamarin if you use EFCore then there is the possibility of mTouch to skip the reflections used by it
more info (and my saving grace) was found here:
https://learn.microsoft.com/en-us/ef/core/get-started/xamarin#explore-the-code

Related

Cannot get Firebase working for Xamarin Forms iOS

I am using Visual Studio 2019 on Windows, developing an App using Xamarin Forms, for Android and iOS. Everything is the latest version.
I am trying to use Firebase to add Push Notification functionality. I have been able to get this functioning for the Android App, but whatever I do seems to fail / not work for iOS.
I have tried using both Xamarin.Firebase.iOS.CloudMessaging and Plugin.FirebasePushNotification with the same result. Starting from a basic app created in Visual Studio, as soon as I add the basic code for the iOS project, the app stops working and just times out after 17 seconds with running any of the project code (no breakpoints are hit).
I also tried downloading this demo app https://github.com/jfversluis/XFFCMPushNotificationsSample. I created my versions of google-services.json (Android) and GoogleService-Info.plist (iOS). The Android app runs but the iOS app does not (times out after 17 seconds).
Having tried so many different samples, examples, options, etc - I am at a complete loss as to what the issue might be. The situation is not helped by me being new to App development & Xamarin Forms!
I appreciate that I haven't added any "I tried this" code, but I'm hoping someone can help me with debugging this. Visual Studio doesn't appear to show anything, can I get more helpful info from the iPhone?
Edit:
For iOS,
I have created a Key and enabled Apple Push Notifications.
I have uploaded the key to the iOS project in Firebase (Cloud Messaging).
I have downloaded the GoogleService-Info.plist file and added it to the iOS project in Visual Studio, and set it to BundleResource
I have enabled Push Notifications in Entitlements.plist
I have enabled Background Modes & Remote Notifications in Info.plist
I am using Automatic Provisioning
I have checked that Bundle Identifier is correct
I have added FirebaseAppDelegateProxyEnabled to info.plist
EDIT 2:
I have manged to get an error message, which happens during the call to
FirebasePushNotificationManager.Initialize(options, true);
{System.NullReferenceException: Object reference not set to an instance of an object.
at Plugin.FirebasePushNotification.FirebasePushNotificationManager.Initialize (Foundation.NSDictionary options, System.Boolean autoRegistration) [0x00029] in /Users/runner/runners/2.169.1/work/1/s/Plugin.FirebasePushNotification/FirebasePushNotificationManager.ios.cs:141
at MyApp.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00014] in \MyKRing.iOS\AppDelegate.cs:34 }

UWP project needs to be deployed before it can be started

I am using visual studio 2017, created a new xamarin forms project and tried to run the UWP project. It shows the following error:
the project needs to be deployed before it can be started. verify the project is selected to be deployed the solution configuration manager, or deploy it explicitly by clinking one of the deploy commands in the build menu.
I have looked at all online solutions and only found that you need to set the cpu to x86 and to check the deploy checkbox under the configuration manager under the solution. Both these options don't work. I still get the same error. I have also tried every cpu option including ARM.
Have you tried to uninstall the existing UWP app from the Windows Start menu > All apps? Then deploy again from VS. It did the trick for me.
Sometimes when I create an app packet for win store; Visual studio seem to get hung up building to the packet (project needs to be deployed before it can be started -error).
I solve it by creating a new app packet.

xamarin.andriod connect to web api

I am currently working on a Xamarin project for Mac and Android mobile devices. I am using Visual studio for mac to create the xamarin project. In my application I have to invoke a Webservice endpoint. As I am still at early stages; both the
Webservice and the Xamarin mobile application are running locally on my machine. When I try to call the Webservice from Xamarin the base url works fine on mac as http://localhost:5000. However when I run android version, I am unable to connect to my local webservice using http://localhost:5000. Is there any workaround for this?
After researching, I have also tried using the following base uri's:
http://10.0.2.2:5000
I have also right-clicked on the project and under Build I went to Android Build. Underneath Code Generation and Runtime I selected Managed (HttpClientHandler) for the option HttpClient implementation. As well as SSL/TLS implementation for the option Native TLS 1.2+.

Android Debugging Failing With "Couldn't connect to logcat, GetProcessId returned: 0" FFImageLoading.Platform.dll.so Not Found

I am having issue debugging Android project. I can deploy to device and run it, all works fine but if I try to debug, the app gets deployed to the device and very briefly opened, splash screen shows up but the app then closes.
I am using Xamarin Forms on Visual Studio 2015.
Device is running Android Oreo (8.0.0). Another device running Android 6.0.1 is debugging fine.
The output shows following:
InspectorDebugSession(11): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(11): Constructed
Android application is debugging.
InspectorDebugSession(11): HandleTargetEvent: TargetExited
InspectorDebugSession(11): Disposed
Couldn't connect to logcat, GetProcessId returned: 0
I checked Logcat and it seem to be having issues finding FFImageLoading library:
Time Device Name Type PID Tag Message
09-18 14:35:52.361 Huawei Nexus 6P Debug 1560 Mono AOT:
image '/usr/local/lib/mono/aot-cache/arm/FFImageLoading.Platform.dll.so'
not found: dlopen failed: library "/data/app/myapp.android.dev-
WEb1bz8edgF7vwx6uCoZ-A==/lib/arm/libaot-FFImageLoading.Platform.dll.so" not found
I have added Nuget package for FFImageLoading to my projects and Droid project references show it as in image below:
This worked for me :-
Deselecting the 'Use Shared Runtime' in Project Properties > Android
Options > Packaging properties
I also had this issue with Android 8.1 and Visual Studio 2017 15.7.4.
There are three steps to got it working again.
Under Android Options, go to Advanced and add your device architecture, in my case it was x86_64.
Go to Tools -> Options -> Xamarin > Android Settings and enable: Provide debug symbols for shared runtime and base class libraries.
And the final step is to delete following Apps from your device:
All Xamarin.Android API Support libraries
Mono Shared Runtime
Your App
After these steps you don't need to disable "Use Shared Runtime" and can Deploy and Debug much faster.
This is a known issue with Oreo and Xamarin Android on Visual Studio for Windows. It works on Visual Studio for Mac apparently. It will be fixed in an upcoming release. In the mean time there is a work around down near the bottom of the bug link above (comment 20).
deselecting 'Use Shared Runtime' in Project Properties > Android Options
delete bin & obj files from solution
clean solution
rebuild the solution it works
One another reason for that is if you dont enable usb debugging on your device, VS 2017 still recognizes your phone and installs the app on your phone. Just after debugging starts, it will throw this error and not continue debugging. Make sure to enable Developer Mode -> Usb debugging like described here
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/set-up-device-for-development

ERROR ITMS-90161 when trying to upload an app built with Visual Studio for Apache Cordova

We just started creating cross platform mobile apps using "Visual Studio Tools for Apache Cordova".
I followed the procedures described in Install Tools to Build for iOS and To run your app on an iOS device. Everything works nicely, the app gets deployed on my USB attached iPhone and runs as expected.
I then tried to upload the app to iTunes, to provide the app via TestFlight to testers and to generally see how app-submitting works:
Build the iOS app as "Release" in VS: it builds and deploys to the iPhone nicely
On the Mac: Start Application Loader, click on "Deliver your App" and navigate to "...remote-builds/builds/"xxx-buildnmb"/cordovaApp/plattforms/iOS/build/device/APPNAME.ipa"
Several checks run OK ("verifying assets, etc.), but it then stops with the error
ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle xxx.yyyyyy.zzzz [Payload/xxx.yyyyyy.zzzz.app] is invalid. [Missing code-signing certificate.] For more information, visit the iOS Developer Portal."
I then discovered the Xcode Project in ".taco_home/remote-builds/taco-remote/builds/<build-number>​/cordovaApp/platform‌​s/ios/" and used Xcode to define the code signing identities in "Build Settings" and the Team information in "General", created the archive via Product-->Archive and submitted it in the Organizer - Archives. And voila it worked!
My questions:
Do I have to use Xcode to submit?
If not, what might I be missing in a) regard to building and signing apps with vs-mda-remote, and b) submitting it with Application Loader?
What are Microsoft's plans in regard to providing access the build settings from within Visual Studio (similar to the ones in Xcode)?
Thanks a lot for any pointers in the right direction.
Thomas
You need to use distribution provisioning profile to sign the package and apps are published to the App Store by using the iTunes Connect website along with the Xcode Archive Tool, which is included with the iOS SDK.

Resources