Forum Xamarin.iOS

UIWebView Deprecation and App Store Rejection (ITMS-90809)

Getting the below warning message after iOS app deployment.

"ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of app updates that use UIWebView APIs starting from December 2020."

Tried to resolve the issue by adding additional mtouch arguments "optimize=experimental-xforms-product-type" and published to the Appstore. But the issue is not resolved, still getting a warning from Appstore.

Is there any solution to it?

Thanks in advance.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Have you utilized Xamarin Forms 4.5?
    I saw someone faced the issue here but he consumed some third-party libraries:
    https://forums.xamarin.com/discussion/comment/404242
    It works after removing the Calabash.
    Moreover, we need to change the linker behavior to make the linker remove the UIWebView part. Please refer to this blog for more information:
    https://devblogs.microsoft.com/xamarin/uiwebview-deprecation-xamarin-forms/

  • RezaMohamedRezaMohamed USMember ✭✭✭
    edited April 1

    @LandLu with the current version of Xamarin.ios 13.16.0.11 is there anything specific to be done? In the post you linked, he is referring to a flag "--optimize=experimental-xforms-product-type" which sounds like an experimental flag that should already be in the build right?

    with the latest version and XF 4.6pre I am still getting that warning from Apple, so wondering what specifically we need to do.

    I believe the Appstore is complaining because of this method that I have for an iOS renderer.

    using UIKit;
    using WebKit;
    using Xamarin.Forms;
    using Xamarin.Forms.Platform.iOS;
    
    [assembly: ExportRenderer(typeof(HybridWebView), typeof(WebViewRender))]
    namespace trainermade.iOS
    {
        public class WebViewRender : ViewRenderer<HybridWebView, WKWebView>, IWKScriptMessageHandler
        {
            WKUserContentController userController;
    
            public void DidReceiveScriptMessage(WKUserContentController userContentController, WKScriptMessage message)
            {
    
            }
    
    .........
    
    }
    
  • LandLuLandLu Member, Xamarin Team Xamurai

    @RezaMohamed This argument should be set even though on a release 4.5 build.
    It makes the linker work on Xamarin Forms package when we set the behavior to Linker All or Link SDKs Only.
    We need this to remove UIWebView from the binary. And we should avoid using UIWebView apis in our project.
    What you posted above is using WKWebView and this is a good attempt.

  • RezaMohamedRezaMohamed USMember ✭✭✭

    @LandLu I am not following what you are saying. The above code is what I have in my project right now, which the Apple Store is complaining about (I don't have any other references to UIKit). So I am still not sure what more to change. Do you have a sample to point to of a compliant version?

  • LandLuLandLu Member, Xamarin Team Xamurai

    @RezaMohamed Have you followed all the steps mentioned in the blog?

    1. Update Xamarin Forms to 4.5 or newer.
    2. Add mtouch arguments "optimize=experimental-xforms-product-type"
    3. Change the Linker Behavior to Link All or Link SDKs Only.

    Add the arguments through right click the iOS project => iOS build => additional mtouch arguments:

    Changes the behavior to

    under release mode.
    Moreover, make sure you didn't reference any third-party library which used old UIWebView API in your project.

  • thisismyselfthisismyself Member ✭✭

    @LandLu @RezaMohamed @krishna_H
    The problem persists for me as well:

    • I now created a new blank Xamarin.Forms project
    • updated it to Xamarin.Forms 4.5.0.530
    • added this --optimize=experimental-xforms-product-type
    • and add this --warn-on-type-ref=UIKit.UIWebView to get the warning in build output

    I am using Visual Studio 16.5.2, containing Xamarin.iOS SDK 13.16.0.11.

    This is my build output:

    2>  App-90809-Blank.iOS -> C:\_Data\DevTemp\App-90809-Blank\App-90809-Blank\App-90809-Blank.iOS\bin\iPhone\Release\App-90809-Blank.iOS.exe
    2>  Detected signing identity:
    2>    Code Signing Key: "iPhone Developer: <this is private>" (F6814A84E7E2C5E7500722F2E0D2B05732F0F0F9)
    2>    Provisioning Profile: "iOS Team Provisioning Profile: *" (9d39d515-5836-4c73-ae70-965739131194)
    2>    Bundle Id: com.companyname.App_90809_Blank
    2>    App Id: L587D9PX85.com.companyname.App_90809_Blank
    2>  /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/<myusername>/Library/Caches/Xamarin/mtbs/builds/App90809Blank.iOS/43de24c37eacad94a422da86304dca6f/obj/iPhone/Release/response-file.rsp --warn-on-type-ref=UIKit.UIWebView --optimize=experimental-xforms-product-type 
    2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(844,3): warning MT1502: One or more reference(s) to type 'UIKit.UIWebView' already exists inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' before linking
    2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(844,3): warning MT1503: One or more reference(s) to type 'UIKit.UIWebView' still exists inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' after linking
    2>  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil -num-threads 4 -z -o bin/iPhone/Release/App-90809-Blank.iOS.app.dSYM bin/iPhone/Release/App-90809-Blank.iOS.app/App-90809-Blank.iOS 
    2>  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -i -s obj/iPhone/Release/mtouch-symbols.list bin/iPhone/Release/App-90809-Blank.iOS.app/App-90809-Blank.iOS 
    2>  /usr/bin/mdimport bin/iPhone/Release/App-90809-Blank.iOS.app/../ 
    2>  /usr/bin/codesign --verify -vvvv -R='anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.1] exists and (certificate leaf[field.1.2.840.113635.100.6.1.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)' bin/iPhone/Release/App-90809-Blank.iOS.app 
    
  • krishna_Hkrishna_H Member
    edited April 2

    Thanks @LandLu for your response,

    I'm using the below environment.

    Xamrin Forms : 4.5.0.356
    Visual studio community for mac : 8.4.8
    Xamarin.iOS : 13.10.0.21

    I have followed all the steps mentioned in the blog which you have shared, but still no luck.

    We are not using Xamarin.Calabash.Start() in our project.
    Will try by removing "#if DEBUG" and i'll keep you posted.

    Thanks,
    Krishna.

  • RobAtKansysRobAtKansys Member ✭✭

    I am running into the same issue with my app, any update on if someone got it working?

  • RezaMohamedRezaMohamed USMember ✭✭✭

    just an FYI, I submitted my app with the suggestions made in the blog in addition to using my WKWebView code and I did not get a complaint from Apple regarding the deprecation of UIWebView.

  • JohnHJohnH GBMember ✭✭✭✭✭

    @LandLu I am going through this now, I have removed all references to UIWebView in our code, updated to XF 4.5, added the --optimize mtouch arg, added the --warn arg, and all I see in the output is several occurrences of:

    MT1502: One or more reference(s) to type 'UIKit.UIWebView' already exists inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' before linking

    I would expect if a 3rd party nuget contained UIWebView it would have listed it, no?

    Anything else I need to do?

    Thanks
    John

  • JohnHJohnH GBMember ✭✭✭✭✭

    For anyone looking for a solution when you are using Azure DevOps:
    I have managed to resolve this with the help of this issue: https://github.com/xamarin/Xamarin.Forms/issues/9823

    Firstly, I didn't realise that --warn-on-type-ref=UIKit.UIWebView triggered logging before linking had occurred, so it showed me correctly I had no references to UIWebView in my code at all, only Xamarin.iOS contained references.

    Secondly, our release builds are actually performed in Azure DevOps, I had to ensure it was running the correct Mono version to get the correct Xamarin.iOS version. Mono 6_6_1 is the minimum according to the link but I updated our build bash script to use the latest (right now that is 6_8_0).

Sign In or Register to comment.