Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Xamarin.Essential issue on iOS #227

Open
Daddoon opened this issue Sep 13, 2020 · 14 comments
Open

Xamarin.Essential issue on iOS #227

Daddoon opened this issue Sep 13, 2020 · 14 comments

Comments

@Daddoon
Copy link
Owner

Daddoon commented Sep 13, 2020

Yup, I was just gonna make a new issue regarding on this just now.

There seems issues with iOS platform when initializing the services.

I integrated secure storage from xamarin essentials for all platforms, SecureStorage never get's initialized on iOS platform.

It worked properly on android emulator and a real device.

But never worked neither on iOS emulator or real iOS device.

https://docs.microsoft.com/en-us/xamarin/essentials/secure-storage?context=xamarin/xamarin-forms

Take note also I experienced a random behavior that for some reason sometime the xamarin services get's cached by the ProxyInterface when generating the proxy methods that are used for native communication.

I ended commenting the service -> rebuild -> uncomment -> rebuild to recreate the proxy method files

Originally posted by @arivera12 in #226 (comment)

@arivera12
Copy link

arivera12 commented Sep 13, 2020

Want me to send a small repro? I will send you one between today and tomorrow.

@arivera12
Copy link

Test Unit

XamarinEssentialsTest.zip

iOS should work out of the box in real iOS device but if you are using the iOS emulator you need to enable the Keychain entitlement and add a keychain access group for the application's bundle identifier.

Check out this link for reference

https://docs.microsoft.com/en-us/xamarin/essentials/secure-storage?context=xamarin%2Fxamarin-forms&tabs=ios

@arivera12
Copy link

Did sample worked for you?

@Daddoon
Copy link
Owner Author

Daddoon commented Sep 16, 2020

Not had time yet to see anything

@arivera12
Copy link

keep me updated. iOS platform seems having few issues.

@arivera12
Copy link

Any update?

@Daddoon
Copy link
Owner Author

Daddoon commented Sep 22, 2020

No, sorry, i have a lot of personnal and administratives things actually, i don't know yet when i will look this.

It's possible that next month i will try to take a look at Mobile Blazor Bindings and how it integrate, in order to see if it is a better option to migrate BlazorMobile projects, for the future. If it's easy and offer the same or more flexibility than BlazorMobile, i will take this root for one of my Business project.

In the other case (keeping strictly BlazorMobile), it's possible that i come back on it to fix some issues, as it seem that their is some instability issues at boot with WebSocket, don't know if it's a conflict or else, but did have a fix in mind. Still for a Business project. Then only i will maybe take a look at this.

As i said before i highly doubt that BlazorMobile is responsible for your issue as i don't see any relationship between Xamarin.Essentials and BlazorMobile.

Also, you have access to the source code of the project, feel free to debug by yourself if you are in a hurry, i can't garantee anything, as this is an open-source project and that i may have to do other things.

@arivera12
Copy link

Ok, I will try anothers xamarin.essentials class to see if its a issue with secure storage with iOS, because this is working properly on android. I will try do my research and give feedback on the things I find in the process.

@arivera12
Copy link

arivera12 commented Sep 23, 2020

I can confirm that the default stock template runs on iOS but...

The BlazorMobile page which displays the Xamarin native alert doesn't never load (behaves the same like my sample project).

I think this a bug on iOS platform which is not allowing communication with native Xamarin for some reason.

I can confirm this works properly on android and even using Xamarin essentials.

But BlazorMobile on iOS in communication with Xamarin seems totally dead or ignored.

Maybe the services aren't getting initialized properly on that platform or what else could be?

Tested Platforms Info
iOS iPhone Version 14.2
iOS iPhone Emulator Version 14.0

@arivera12
Copy link

In my personal conclusion I think #226 are related at some point with this issue.

I tried all stuff that the other guy from the other issue wrote.

Also I didn't know that web assembly isn't supported on iOS emulator as mentioned here #216 (comment). This should be mentioned in the main docs.

I tried android emulator on Visual Studio 2019 for MacOS and it's doesn't work when navigating to the blazormobile page as metioned here #226 (comment).

@Daddoon
Copy link
Owner Author

Daddoon commented Sep 25, 2020

As your issue is on native side with Xamarin.Essentials, still i don't see yet why it should be related Blazor WASM. Not saying that there is no bug, but i don't think that there is any relationship with Blazor on the web part.

Yes Blazor does not work in WASM mode in the iOS simulator because Apple is too lazy to implement this on their side, i don't know why, a lot of people reported this issue to Apple (No WASM support on iOS).

I will take a look to all theses things when i will come back to my business project in October, but i'm doing some pauses for now.

Also as mentionned on the other thread, i didn't tested the tooling and behvior deploying from MacOS. Only Windows, i'm afraid.
I will keep things updated in few days so, wether fixing the issues directly, or propose migration to Mobile Blazor Bindings if it's easy to migrate, as all the app and C# context will be executed in the same memory area, it will surely fix any possible interop problem on some OS.

@Daddoon
Copy link
Owner Author

Daddoon commented Oct 3, 2020

As you may have tested Mobile Blazor Bindings: Is your issue solved with Xamarin.Essential while using it ?

@arivera12
Copy link

I haven't tested this with Mobile Blazor Bindings yet. Let me give it a try and I will reply back.

@arivera12
Copy link

There are still few issues on Mobile Blazor Bindings and that's why I haven't tested yet.

First one is that IJSRuntime is not being initialized by default as a default Hybrid service and there is no Blazor Wasm and Server projects.

There is already a workaround IJSRuntime that I personally tested out and works.

For Blazor Wasm and Server projects I played around a bit and got it to make it work but I still needed the wwwroot folder and all stuff in there cause I don't know how to load embed RCLs into blazor.

Blazor needs an entry point no matter what and he always look at wwwroot/index.html

Not sure how Blazor Mobile Bindings gonna manage this and also expose static assets.

I think they will need to still copy the wwwroot folder entirely to the blazor project and add the webassembly.js reference to the index.html.

I tried to see if there any web approach to load from embed resource blazor mains entry page but didn't find anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants