Xamarin form: icons/image not showing which usually work before - image

Having problem not showing the ffimageloading image on the listview on iOS12.1.3 later by the client and it happened many time even though not always but it works on my local ipad, which i am not sure how to tackle.
Now it looks like also affecting the android devices. The client used to be working and it's now not working
I have initialize the init function in AppDelegate which is required otherwise my device also won't see.
Only thing i have inside was an delayloading and downSampleToViewSize which i am not sure what cause it.

Related

Call c# function from javascript in Xamarin.Forms Webview

I want to make call of some c# code when user tap on a button in html. I followed below example and also tried it and it is working for my purpose if i use it as it is.
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview
It uses index.html from assets, instead i want to use some URL where my html page is. But unfortunately when i change url, it stops invoking c# code.
Please let me know if there are any changes needed to get it working.
It was some firewall settings blocking communication from my iOS simulator, got it fix after adding certificate.
Example demo is working fine now

Xamarin: InitializeComponent () is too complex

I am currently developing an App for IOS and Android with Xamarin Forms. I am debugging with my Android device.
Starting yesterday, when trying to build and test my solution, it falls into a break state before the App is even loaded.
The exception is:
System.InvalidProgramException: Method wuut.Discover:InitializeComponent () is too complex.
It works when I unplug my Android device and open the App on developer mode. But I really need the Console etc. so right now, I am unable to continue developing my app.
I looked up the exception on Google but couldn't really find anything similar to my problem.
The error occurs inside InitializeComponent on one of my Contentpages containing an AbsoluteLayout.
The AbsoluteLayout is rather big with 5400 Lines of Code. So looking into the error messages, I tried to remove a few chunks of my XAML and it started working again.
So my question is: Does XAML or Xamarin have some limitations on how big an AbsoluteLayout/Contentpage should be? If not, how would I resolve this issue?
Thanks in advance and kind regards

Configure platform page with platform specific options

We've begun evaluating Xamarin for a up and coming project involving both iOS and Android, with the overriding intention to produce a single UI layer (and some share code, obviously) (I'm also new to C#)
TL;DR
I've begun exploring Xamarin on iOS. I started with the Phoneword example and it worked well enough.
The first issue I found was running the code on the iPhone X, which I was able to solve by using MainPage.On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); in the platform App class
While testing this, I noticed some issues with the ListView not scrolling properly (the core issue was actually with the platform padding).
I then used (MainPage as Xamarin.Forms.NavigationPage).On<iOS>().EnableTranslucentNavigationBar(); to enable translucent navigation bars (as we're targeting iOS 11+) and now everything appears under the navigation bar.
This is easily fixed in xCode and after some research I've found that I need to be using UIKit.UIViewController.EdgesForExtendedLayout Property, the immediate problem I'm facing is, the only "snippets" of code I can find are from the View is displayed under status bar in iOS 7 and EdgesForExtendedLayout doesn't help forum post.
Issue at hand...
The example solution snippets posted seem to be making use of a platform (iOS) specific solution. The problem is, I want to keep using the "cross-platform" code in the "platform" project and simply provide some custom configuration for the iOS platform which can apply these states.
I understand it could be possible to use a renderer, but this seems to counter-interactive, as I'd need one for both iOS and Android, where the platform page is doing just fine as it.
I understand that I could setup a DependencyService, but this seems annoying to have to include a specific "configuration" service just to solve this issue for iOS
I was hoping it might be possible to setup a iOS Page which would "override" some of the functionality of the platform page and would allow me to make use of things like viewDidLoad so I can apply the iOS specific configurations on a page by pages bases, so we could keep the platform page as it, but when running under iOS, it would provide me access to iOS life cycle of the actual view...
I've been trying to search the documentation and tutorials and haven't yet come across anything which would seem to do this or something similar (not to say there isn't one, but I'm just not finding it).

Xamarin MediaMager notifications on Android

I use the following code to start playing a local audio file. To my disappointment, no notification is shown on my Android emulator. After some digging, I notice that the Android MediaNotificationManager has all the code commented out.
I can see from a few other on GitHub, that other people does seem to have notifications (ironically, a few people seem to have problems getting rid of them - Example), so what do I need in order to get it?
IMediaFile mediaFile = new MediaFile(playRequest.Path, MediaFileType.Audio, ResourceAvailability.Local);
mediaFile = await CrossMediaManager.Current.MediaExtractor.ExtractMediaInfo(mediaFile);
await CrossMediaManager.Current.Play(mediaFile);
CrossMediaManager.Current.MediaNotificationManager.StartNotification(mediaFile);
CrossMediaManager.Current.MediaNotificationManager.UpdateNotifications(mediaFile, MediaPlayerStatus.Playing);
I found a reason. Notifications on Android require an Icon. By inspecting the source code of MediaNotificationManager, I found that on Android it actually handles notifications in a completely other class: MediaNotificationManagerImplementation found in MediaSession.
There, I also learned that it will look for an icon of type Android.Graphics.Bitmap in the property Art on the metadata. Curiously, the property ArtUri is not used for anything.
If this property is null, it will look for a drawable in resources, with the name xam_mediamanager_notify_ic. If none is found, it will use the application icon.
Now, this solves all my needs for Android. However, it's handled quite differently on other platforms, and I've yet to find out how to set the art on UWP (and I've not tested iOS yet).

View loading as blank/white screen in Mac desktop application Xamarin.Mac

I have a Mac desktop application developed using Xamarin.Mac and XCode. The application is loading views that should have a considerable amount of content as blank/white screens for a select few end users. While I've not been able to reproduce the issue locally and it doesn't appear to be impacting many people, it does happen consistently for a handful of users(6 out of over 4,000 at the moment). The app works just fine for the vast majority and uses a main window controller that sets the content view as needed by calling the applicable ViewController. When the views in question are loaded for the given users, it renders as a blank white area.
I did notice however that at least some of the objects in the views are actually there, just not visible. For instance, one view has buttons that are still "there" as you can click on them if you know where they are supposed to be positioned(and they also fire correctly) but they are not actually visible as the area is all white with no visible content. It's as if everything is loading properly but the UI just isn't cooperating in displaying objects that are actually there. The closest thing I could find was this Diagnosing run loop issue (partially frozen UI) in Cocoa application
However I'm not sure it's the same problem and there was no resolution for that either. Has anyone else ever encountered something like this?
Ok, got some new info. After doing a remote session with a user we had no luck with the hardware and the console didn't provide much insight, however we did stumble across a workaround that fixes the issue and may give some clues as to the real problem.
When the application is initially installed, we prompt the user to ask if they want it moved to the default Applications directory. They do not have to move it as it will work the same from pretty much anywhere but we do this for convenience. For the users having this problem, we noticed that they all had the app installed in the Applications folder. By sheer luck, one user accidentally chose to not move the app after reinstalling it per our support team. When the app was installed in his default Downloads directory, the problem vanished and the app worked as expected.
After testing various other directory locations(Downloads, Documents, etc.) we found that the issue only seemed to exist if the app was installed in the Applications directory. Furthermore, if the app was installed in the Applications directory, we could simply move it or copy/paste it to another directory outside Applications and when launching it from that new location the issue was resolved.
Seems like there is something specific to the default Applications directory that is causing this to happen(as odd as that sounds). Keep in mind that even when the app is installed in the Applications directory, this issue only happens to 7 people out of over 4,000.
Any ideas as to what might be special about that directory that could explain what we're seeing?

Resources