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

IOS Linker fixes inside Xamarin.Forms #8001

Merged
merged 5 commits into from
Dec 1, 2019
Merged

IOS Linker fixes inside Xamarin.Forms #8001

merged 5 commits into from
Dec 1, 2019

Conversation

PureWeen
Copy link
Contributor

@PureWeen PureWeen commented Oct 14, 2019

Description of Change

  • Removes the Preserve Attribute from the Xamarin.Forms SDK
  • Removing the Preserve Attribute will have little to no effect until this change [prototype][linker] Do not mark NSObject subclasses from Xamarin.Forms.* assemblies xamarin-macios#7165 makes it into Xamarin.iOS SDK
  • Ironically the RenderWith attribute causes all the renderers to not link out. I've ran this branch against the UI tests and all the UI Tests pass with this change. We'll want to test this change against the Forms Samples and really basic projects to make sure full linking doesn't break those projects.
  • Add Linker Safe Attribute so that (Assembly-level attributed used to inform MonoTouch's linker that this assembly can be safely linked, regardless of the system linker settings.)

This won't really cause anything to get linked out of the forms platform dll but it sets up the library so that some day maybe it can. It also let's us start testing this against our UI tests and master nightlies to make sure everything still works

Issues Resolved

Platforms Affected

  • iOS

Testing Procedure

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@PureWeen PureWeen added the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Oct 14, 2019
@PureWeen PureWeen force-pushed the ios_linker branch 2 times, most recently from 8d26f69 to 58f52d9 Compare November 5, 2019 17:25
@PureWeen PureWeen removed the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Nov 5, 2019
@PureWeen PureWeen marked this pull request as ready for review November 5, 2019 17:36
@samhouts samhouts requested review from hartez and samhouts November 5, 2019 21:29
@PureWeen PureWeen mentioned this pull request Nov 5, 2019
@PureWeen PureWeen added the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Nov 16, 2019
@PureWeen PureWeen requested review from jfversluis and removed request for samhouts November 19, 2019 18:00
@PureWeen PureWeen assigned jfversluis and unassigned samhouts Nov 19, 2019
Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it, everything still seems to work. Yay!

@PureWeen PureWeen removed the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Nov 27, 2019
Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, build failed, looked like a fluke, I've triggered them again

@PureWeen PureWeen merged commit 669ad96 into master Dec 1, 2019
@DanielGramsJTL
Copy link

Coming from #7323: Which Xamarin.Forms version will include this fix? Many thanks in advance!

@jfversluis
Copy link
Member

@DanielGramsJTL I've update the issue

@samhouts samhouts added the approved Has two approvals, no pending reviews, and no changes requested label Dec 2, 2019
@zhsyedabbas
Copy link

zhsyedabbas commented Dec 13, 2019

Updated Xamarin Forms to v4.4.0.991265.
But when building the project the Xamarin.Forms.Platform.iOS.dll still references the UIWebView
I can see the dll was built and signed on dec10, 12:29 am.

Here's a screenshot from ILSpy
image

I can see the file has been updated here (https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/RefreshViewRenderer.cs), but isn't available in the build?.

Thanks

@PureWeen
Copy link
Contributor Author

@zhsyedabbas this PR will show up in 4.5

I want to heavily emphasize that this PR will have zero effect on the warning about using UIWebView until changes are made to the Xamarin.iOS SDK

Which is another reason this PR is targeting master because it's currently irrelevant to have any of these code changes

@samhouts samhouts added this to the 4.5.0 milestone Jan 8, 2020
@moustafashaban
Copy link

@PureWeen I am on 4.5.0.187-pre2
but I am still getting an email from Apple:

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs

@DanielGramsJTL
Copy link

Hi there! I am bulding Xamarin.Forms 4.5.0.187-pre2 with Xamarin.iOS 13.10.0.17 and --optimize=experimental-xforms-product-type. The linker is set to SdkOnly.

When i launch the app, it crashes with an exception saying "Default constructor not found for type Xamarin.Forms.Platform.iOS.BoxRenderer". I am using BoxView, but only in xaml.

I saw in the code that the BoxRenderer does not have a default constructor with [Preserve(Conditional = true)].

Is there a way to tell the linker to keep the BoxRenderer? Many thanks in advance!

@chrisparkeronline
Copy link

I am still getting the email as well. It is not hindering them accepting my app at this point.

@DanielGramsJTL
Copy link

Hi there! I am bulding Xamarin.Forms 4.5.0.187-pre2 with Xamarin.iOS 13.10.0.17 and --optimize=experimental-xforms-product-type. The linker is set to SdkOnly.

When i launch the app, it crashes with an exception saying "Default constructor not found for type Xamarin.Forms.Platform.iOS.BoxRenderer". I am using BoxView, but only in xaml.

I saw in the code that the BoxRenderer does not have a default constructor with [Preserve(Conditional = true)].

Is there a way to tell the linker to keep the BoxRenderer? Many thanks in advance!

Just in case, anybody has the same problem: I solved it by adding
[assembly: Preserve(typeof(BoxRenderer), AllMembers = true)]
to AppDelegate.

Btw, after updating i do not get the warning mail from Apple anymore.

@samhouts samhouts deleted the ios_linker branch June 26, 2020 00:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs
8 participants