Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

UIWebView deprecated workaround not working with a bare shell app #10967

Closed
stephenhauck opened this issue Jun 5, 2020 · 27 comments
Closed

UIWebView deprecated workaround not working with a bare shell app #10967

stephenhauck opened this issue Jun 5, 2020 · 27 comments
Labels
a/shell 🐚 a/webview s/unverified New report that has yet to be verified t/bug 🐛

Comments

@stephenhauck
Copy link

stephenhauck commented Jun 5, 2020

Trying to get an app to build for submission and can't get rid of the UIWebView reference so I tried a bare bones out of the box shell app .. same failure ...

I need help ASAP!

  • Visual Studio is the latest on both Mac and Windows

image
Xcode is current

  • I created a Xamarin Forms Shell app targeting iOS and Android on a Windows machine
  • Made the settings changes like you indicated
  • Updated the NuGet packages, none used except the ones that are defaulted with a new Xamarin Forms Shell app
    image

Here are my iOS build settings
image

Here is the output
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/stephenhauck/Library/Caches/Xamarin/mtbs/builds/UIWebKitTest.iOS/1188bde15273392423d3b6bb90f2fefd/obj/iPhone/Release/response-file.rsp --optimize=experimental-xforms-product-type --warn-on-type-ref=UIKit.UIWebView
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,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
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,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
3>
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil -num-threads 4 -z -o bin/iPhone/Release/UIWebKitTest.iOS.app.dSYM bin/iPhone/Release/UIWebKitTest.iOS.app/UIWebKitTest.iOS
3> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -i -s obj/iPhone/Release/mtouch-symbols.list bin/iPhone/Release/UIWebKitTest.iOS.app/UIWebKitTest.iOS
3> /usr/bin/mdimport bin/iPhone/Release/UIWebKitTest.iOS.app/../
3> /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/UIWebKitTest.iOS.app
========== Rebuild All: 3 succeeded, 0 failed, 0 skipped ==========

@stephenhauck stephenhauck added s/unverified New report that has yet to be verified t/bug 🐛 labels Jun 5, 2020
@stephenhauck
Copy link
Author

I did forget to mention that I run Resharper and MFractor as well so I have attached my source in case the generation of the project from the template was affected in some way.
UIWebKitTest.zip

@jfversluis
Copy link
Member

Did you actually submit this to Apple? I have seen cases where you get false positives in the build output, but Apple will accept them without a problem.

Furthermore please provide the information and output from the suggestions here: #10739 (comment)

@stephenhauck
Copy link
Author

stephenhauck commented Jun 5, 2020

I have not submitted to Apple .. until it stops reporting the error why try, I mean I don't want to "wonder" every time right?

I start a command prompt
change to the project output directory ..\UIWebKitTest.iOS\bin\iPhone\Release>

run this command "FINDSTR /M /s /i uiwebview . > uiwebviewresults.txt"

get this output in the file
Xamarin.Forms.Platform.iOS.dll

@stephenhauck
Copy link
Author

PLEASE, don't hesitate to ask me to run with some debug options / switches or something turned on if it will get you more information ....

I have been a paid user of Xamarin since it was Monotouch and was EXPENSIVE so I know we are in a MUCH BETTER PLACE now but we still have some issues occasionally and I am willing to help...

@stephenhauck
Copy link
Author

FYI, I just upgraded OSX (wasn't that far behind) and still get the same results ....

@stephenhauck
Copy link
Author

I also replaced the default bundle id just in case that was causing the build to bypass a step and that didn't do anything ....

@saidbehaine
Copy link

Hi @stephenhauck. Did you find a solution? I was trying this too: --optimize=experimental-xforms-product-type but the app crashed when apple team made tests.

This is the crash log result

@stephenhauck
Copy link
Author

Thanks for the additional information!

I have not submitted to the app store because when I grep (findstr) after the build it finds the reference so why even bother.

I am NOT interested in GUESSING or HOPING, this is programming and I should know that when the software leaves my control that I have built the best product possible and that it will pass without issue.

Are you able to simply start a new project and get it to build without the reference being included ?

@jfversluis
Copy link
Member

I’ve just created a File > New Shell App. Applied all the necessary bits and it’s accepted by Apple without any warning. So I’m not really able to reproduce this behavior unfortunately

@stephenhauck
Copy link
Author

stephenhauck commented Jun 8, 2020

@jfversluis if you grep or findstr it finds the reference correct ?
If it does then how do I know which "violations" will be accepted and which wont't ?

@stephenhauck
Copy link
Author

I just updated to Xamarin.Forms 4.6.0.847 and findstr still reports it found a reference in
Xamarin.Forms.Platform.iOS.dll

@jfversluis
Copy link
Member

I am not seeing any references or warnings in Visual Studio as well.

I have to note that this is on a Mac with Visual Studio for Mac although that shouldn't matter.
Just now I have taken the repro project that you've attached here and tried it on that.

The thing I'm noticing is that the build configuration sometimes will jump back to using the Simulator. Not sure if this is a bug in VS/VSMac or anything and if it even has to do with anything, but it's strange.

So, with your project I do see the warnings pop up in VSMac at least. Can't really determine what the difference is between your project and mine

TestShellWebview.zip

@stephenhauck
Copy link
Author

I am comparing right now ...
Initially it builds without warning but it only has an iOS app, it is not targeting Android and iOS in the same solution.

@jfversluis
Copy link
Member

Why should Android be involved? This is a pure iOS specific problem. But I guess that is a difference. So one testing scenario could be to create a separate solution with just the bits for your iOS app then

@stephenhauck
Copy link
Author

Android should not affect it I agree ...

So .. I made a new Shell app on VS Mac (Android included), updated nuget packages included by default and built .. it DOES NOT give the warnings !

@stephenhauck
Copy link
Author

I just created an iOS only Shell app on Visual Studio Windows and updated the included nuget packages and it fails with the warnings.

It selected the correct build configuration ...
2>------ Rebuild All started: Project: UIWebView_iOS_Only.iOS, Configuration: Release iPhone ------
image

But warns ....
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,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\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,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

@stephenhauck
Copy link
Author

I just brought the same project from the Mac to a Windows Machine and it fails with the warnings.

@stephenhauck
Copy link
Author

BTW, not sure I mentioned .. I ONLY use the stable channel for updates and release NuGet packages!

@stephenhauck
Copy link
Author

@jfversluis can you confirm you are seeing the same thing as me ?

@jfversluis
Copy link
Member

jfversluis commented Jun 9, 2020

From a quick test I think I see the same thing happening, yes.
Have you tried taking the Mac project (without warnings) to Windows and see what happens then?

If that works, then it almost certainly has to be something inside the csproj file messing things up between Mac and Windows.

I just did, doesn't work. So, at this point this seems to be the case:

  • proj created in VSWin, built on VSWin, has warnings
  • proj created in VSMac, built on VSMac, no warnings
  • proj created in VSWin, built on VSMac, has warnings
  • proj created in VSMac, build on VSWin, has warnings

I'll go ahead and try to upload the one I know that works from VSMac but does produce warnings on VSWin to see if it's a false positive.

Edit: OK, so ignoring the warnings and just uploading works. No warning from Apple.

That means VSWin will give false positives

@stephenhauck
Copy link
Author

OK, I just confirmed your assessment that if it's created on a Mac and built on a Mac it works.
So ... are you saying that if you get the warning and it's in Xamarin.Forms.Platform.iOS that it should be passed by Apple without issue and warnings outside that assembly / dll should be ignored ?

@jfversluis
Copy link
Member

jfversluis commented Jun 9, 2020

The problem with these findings is, is that the results are now unreliable for this part. I mean, it could pass on Apples side and the warnings are false positives. But you, as the developer, could also have done something wrong and it won't pass, which makes the warnings valid.

In any case, I would say this is more something on the tooling/Visual Studio/Xamarin.iOS side of things rather than a Forms thing.

@stephenhauck
Copy link
Author

OK ... so ... how would you advise us to deal with the issue at this time ?

@jfversluis
Copy link
Member

jfversluis commented Jun 9, 2020

Since the binary is accepted by Apple, I would expect that the "string search" method would need to come up empty whenever a build is valid. That might be something interesting to try in this whole scenario.

A quick test of mine seems to verify that; doing a grep -r UIWebView . on the contents of the IPA built on Windows, with warnings, gives no result on that command

Other than that, only Apple gets to decide what they accept or not and how they determine they do, so trial and error.

@stephenhauck
Copy link
Author

I am a little confused because I get these results when I build and check using "FINDSTR /M /s /i UIWebView . > uiwebviewresults.txt" in the output folder
"..\TestUIWebView_OnMac.iOS\bin\iPhone\Release" it still finds references

TestUIWebView_OnMac.dll
TestUIWebView_OnMac.iOS.exe
TestUIWebView_OnMac.pdb
Xamarin.Forms.Platform.iOS.dll

with these settings..
image

It's really not supposed to be this hard ...

@jfversluis
Copy link
Member

jfversluis commented Jun 9, 2020

Tbh I don't think it is that hard. Because all we are talking about here is theory. Well, not all, I have submitted two builds and they were both accepted without any problem.

I think the results you are seeing are valid. What happens is, is that the actual build happens on your Mac. So the binaries that you are looking on on Windows and you are running the findstr against aren't the right ones. Coming to think of it, that might actually be the cause for the false positives on Visual Studio Windows as well. They're inspecting the wrong binaries.

If you build and IPA and extract that, or locate the temp files on your mac, and inspect those, I'm sure the references won't show up. I'll open an issue for the false positives on the Xamarin.iOS repo, other than that I don't see any problem here :)

@jfversluis
Copy link
Member

As mentioned, whatever is going on, it's not Forms related. Added an issue on the X.iOS repo here: xamarin/xamarin-macios#8814

Hence, closing this one.

Thank you so much for all the investigation, collaboration and patience so far!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/shell 🐚 a/webview s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

4 participants