Xamarin Forms essentials Preferences - xamarin.forms

According the documentation on Xamarin Essentials Preferences. I understand that the preferences will removed when the app is unistalled.
Persistence
Uninstalling the application will cause all Preferences to
be removed. There is one exception to this, which for apps that target
and run on Android 6.0 (API level 23) or later that are using Auto
Backup. This feature is on by default and preserves app data including
Shared Preferences, which is what the Preferences API utilizes.
My question is, when an app is updated on iOS or Andriod is that considered uninstalling and re-installing and the preferences get removed? Or just an install and nothing is removed?

No an uninstall really means an uninstall. So actually remove the app and then reinstall from the store.
An update will retain the preferences.

Related

Xamarin Forms 5.0.0.2012 Hot Reload Not Working

I have updated the project as per the Visual Studio prompt to Xamarin Forms 5.0.0.2012.
When I deploy my Xamarin Forms app I see in the hot reload section of Vs 2019 that Hot Reload is initialising. When I make changes to the XAML and save I see that Hot Reload in connected and appears to be sending the XAML changes. However, there are no changes applied to the running app's screen. I have tried two diffrent Emulator versions and my own Samsung S8 device running Android 9.Tried scanning S.O. for answers but none.
Microsoft Visual Studio Community 2019 Preview
Version 16.10.0 Preview 1.0
Xamarin 16.10.000.21 (main#240d4e4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.10.0.0 (remotes/origin/8affbf0abc24122abd5517b2b52f1073cb52bd7b#8affbf0ab)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Make sure that all projects use Xamarin.Forms packages of the 5th version.
Check the MS VS studio version. Make sure that you have installed the latest stable release.
Make sure you have installed latest SDKs for Android and IOS platforms.
Check XAML Hot reload settings. It must be enabled.
There are two modes of reloading in settings:
a) reload only components with changes (default)
b) reload a page entirely
if the first does not work, try the second mode.
The latest MS VS version (16.11.3.0) has the button having the fire icon which forces to apply Hot reload.
Also one important setting that can be enabled: all changes will be applied on you click Save. So hot reload will applied only after you save the xaml (ctrl+s)
Open Visual Studio Output window, choose Xamarin Hot Reload from the dropdown list, check whether a reload is started and whether changes are sent to your app using the appeared logs.
How to locate settings: MS Visual Studio Options -> Debugging-> Hot Reload.
Watch the screenshot with setting using the link below:
Hot Reload settings screenshot
Do something like this :
"Tools => Options => Xamarin => Hot Reload"
Click this link for more informations

Xamarin Android app out of the box shows undefined Android.Support, Android.Views, Android.Content in MainActivity

I needed to rebuild my fairly ancient Xamarin Forms app from scratch and in the process arrived at a situation where I had a new working iOS app but had needed to delete the draft Android app and start it again. So as a next step I added a vanilla Android app project out of the box and immediately what I saw was that (in MainActivity) Android.Support, Android.Views and Android.Content were undefined with wiggy red lines beneath -- for example in a reference to Android.Support.V7.Widget.Toolbar.
Trying to solve the problem, I set each of Target Framework, Minimum Android Version and Target Android Version to Android 9.0 Pie (API Level 28). In SDK Manager I checked that Android SDK Location and Java SDK Location were 'Found' and that Android SDK Platform 28 was installed.
The following NuGets came installed along with the project, I deleted them and reinstalled them (removing bin/obj folders in between): Xamarin.Android.Support.Core.Utils, Xamarin.Android.Support.CustomTabs and Xamarin.Android.Support.Design.
I tried installing NuGets Xamarin.Android.Support.v7.*. And I added the Xamarin.Forms NuGet. I tried adding 'use' declarations.
None of this helped.
For comparison I separately installed a blank Android app solution-- it worked perfectly out of the box.
Android is pretty new to me - would be grateful for suggestions on fixing this.
The app has a .NET Standard 2.0 project, an iOS project, the (vanilla) Android project (all three with Xamarin Forms), and a .NET Standard 2.0 library project.
I'm using Visual Studio for Mac V8.5.4 (stable) on MacOS 10.15.3.
I noticed that the content of MainActivity.cs is quite different, depending whether the Android project is created separately or as part of a Xamarin Forms solution. Also the provided NuGets are different. So perhaps what I was trying to do, adding an Android app to an existing XF solution, is simply not allowed.
To fix the problem, I created an empty Xamarin Forms solution with Android and iOS projects, added a further empty library project, then in Finder replaced the content of all the project folders, except the Android one, with the content of the corresponding folders in my working solution (the one with a working iOS app).
Migrating to AndroidX is a good idea though.
I don't know if this will help, but you should migrate to AndroidX as soon as possible, nevertheless. Xamarin has migrated to them, starting from Forms 4.5
Here is some more information about the libraries - Introducing AndroidX for Xamarin
There is a special NuGet package for the migration - Xamarin.AndroidX.Migration. Also available is a built-in functionality in Visual Studio - here
What I can suggest is you try to migrate to AndroidX libraries, since the old support libraries won't be supported from now on, and you will surely encounter some issues if not like this one, then something else will pop-up in the future.

Visual Studio iOS ripple not reflecting app changes

iOS ripple interface does not get updated to the latest interface when rebuilding. Android and Windows does but iOS doesn't reflect changes made. i have cleaned both solution and project, deleted bld folder etc, nothing seems to make iOS ripple reflect app changes.
is there something i'm missing?
I've run into the same issue with Android. In order to get it working again, I did the same things you mentioned above and also, in the configuration manager, I set the platform to Android and confirmed that Deploy checkbox is selected for the platform.
what i did to get it to work was to go to my root projects and delete the ios folder in the platform folder. that forced apache cordova to rebuild and it showed me the latest app update

Visual Studio 2015 Cordova iOS .ipa Location

I'm trying to release an iOS app built using Visual Studio 2015 Cordova Tools. I can deploy to the simulator and to my device just fine. But I can't find where the .ipa file is being created? My bin/iOS/release folder is empty even after cleaning solution, restarting, and rebuilding.
I have not tried with the latest versions, but I never found that I could build a release version from VS for iOS. I always went and opened the project on the Mac with XCode, using the project in the remote-build folder, tweaked the project settings (VS project never seems to allow multiple device orientations, I need to check on the others, choose the correct developer profile, and usually correct the bundle identifier). Then build and submit to app store from XCode as a normal iOS app.
Perhaps the latest versions are better on this, but I doubt you will find the app bundle in your VS solution folders, it would have to be on the Mac.

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