-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Foundation] Add NSProxy stub in order to workaround bug 59247 (#2693)
https://bugzilla.xamarin.com/show_bug.cgi?id=59247 We need to have a better solution that removes all what NSProxy does not responds to. Right now this works because NSObject implements NSObject protocol just like NSProxy, but NSProxy responds to far less selectors hence doing it internal so it is not a breaking change when we provide the correct fix. * Keep NSProxy around and avoid XML linker description We need to keep NSProxy (avoid linking it) if WKNavigationDelegate or IWKNavigationDelegate is used. We know WKWebView will be there and can hold a reference to it.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// NSProxy.cs | ||
// | ||
// Authors: | ||
// Alex Soto <alexsoto@microsoft.com> | ||
// | ||
// Copyright 2017 Xamarin Inc. All rights reserved. | ||
// | ||
|
||
// HACK: | ||
// Yep this is just a hack to workaround https://bugzilla.xamarin.com/show_bug.cgi?id=59247 | ||
// we need to have a better solution that removes all what NSProxy does not responds to. | ||
// Right now this works because NSObject implements NSObject protocol just like NSProxy, but | ||
// NSProxy responds to far less selectors hence doing it internal so it is not a breaking change | ||
// when we provide the correct fix. | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using XamCore.Foundation; | ||
using XamCore.ObjCRuntime; | ||
|
||
namespace XamCore.Foundation { | ||
[EditorBrowsable (EditorBrowsableState.Never)] | ||
[Register ("NSProxy", true)] | ||
internal abstract class NSProxy : NSObject { | ||
} | ||
} | ||
|
||
namespace XamCore.WebKit { | ||
// We need to keep NSProxy (avoid linking it) if WKNavigationDelegate or IWKNavigationDelegate | ||
// is used. Unfortunately [Preserve] can't help us here because we do not generate partial | ||
// interfaces rigth now, so we know WKWebView will be there and can hold a reference to it. | ||
public partial class WKWebView { | ||
[Preserve (Conditional = true)] | ||
static Type hack = typeof (NSProxy); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters