Daddoon / BlazorMobile

Create full C# driven hybrid-apps for iOS, Android, UWP & Desktop with Blazor!
MIT License
413 stars 55 forks source link

UIWebView issue when app publish on the app store #234

Closed ghost closed 3 years ago

ghost commented 3 years ago

We are creating an app on the Blazor cross-platform approach use. When I deploy the iOS mobile app is working fine on my mobile.

But when I publish the app on the app store then a mail comes from the app store "New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability.".

So how to proceed now to upload the app to the app store.

Daddoon commented 3 years ago

Hi,

Everything is written in this README for this issue. See here: https://github.com/Daddoon/BlazorMobile#itms-90809-deprecated-api-usage---apple-will-stop-accepting-submissions-of-apps-that-use-uiwebview-apis .

I think following Microsoft guidance here should be enough then: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#uiwebview-deprecation-and-app-store-rejection-itms-90809

ghost commented 3 years ago

Hi Daddoon, Thanks for your support.

I have to change the Link Behaviours to Link All then I facing the issue "Default constructor not found for type BlazorMobile.iOS.Interop.WebViewService" when the iOS project deploys.

Please suggest me how to resolve the issue.

Daddoon commented 3 years ago

I don't have the time window to do any change on the project for now. But in my opinion the issue is because of the Linker being too aggressive when choosing "Link All".

I never tested with LinkAll at the moment, and who knows if something else would break with this mode.

However it seem that you can do something to that on your side. As stated on this StackOverflow question , you should be able to force the Linker to preserve some Type / Class's from your own assembly.

So you should:

using System;
using System.Collections.Generic;
using System.Linq;

using Foundation;
using UIKit;

//THE PRESERVE ATTRIBUTE YOU HAVE TO ADD, JUST BELOW
[assembly: Preserve (typeof (BlazorMobile.iOS.Interop.WebViewService), AllMembers = true)]
namespace BlazorMobile.Sample.iOS
{
    public class Application
    {
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
    }
}

Keep me updated if this solve your issue.

ghost commented 3 years ago

Hi, @Daddoon uses the above solution, the project running fine and publish to the app store for review.

Only one thing changes on the Nuget package "Xamarin Form Update above the 4.6 and below Xamarin Form 5.0 Thanks

Daddoon commented 3 years ago

Thanks for the feedback ! Can you confirm that you also had to keep "LinkAll" enabled in your build for iOS ? I will try to eventually give more information hint on the documentation.