Bug 25597 - Method not found
Summary: Method not found
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-12-23 17:20 UTC by Sergi Czerkasow
Modified: 2015-01-06 11:01 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Sergi Czerkasow 2014-12-23 17:20:28 UTC
after migrating to unified api, piece of code that was working before, now refuse to cooperate.

System.MissingMethodException: Method not found: 'UIKit.UIWebView.set_Delegate'.
  at Xamarin.Auth.WebAuthenticator.GetPlatformUI () [0x00000] in <filename unknown>:0
  at Xamarin.Auth.Authenticator.GetUI () [0x00000] in <filename unknown>:0
  at Sodexo.Ipad2.SDXLoginVC.PresentAuthScreen () [0x00070] in /Users/aneta/Development/Sodexo/sodexo.ipad2/ViewControllers/Login/SDXLoginVC.cs:145
  at Sodexo.Ipad2.SDXLoginVC+<LoadApplicationSettings>c__async0.MoveNext () [0x00152] in /Users/aneta/Development/Sodexo/sodexo.ipad2/ViewControllers/Login/SDXLoginVC.cs:82


i use WebRedirectAuthenticator and it explodes when i call GetUI()


details of implementation :

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

using Xamarin.Auth;
using Foundation;

namespace Sodexo.Ipad2
{
	class FedAuthWebRedirectAuthenticator : WebRedirectAuthenticator
	{
		public FedAuthWebRedirectAuthenticator(Uri initialUrl, Uri redirectUrl) : base(initialUrl, redirectUrl) { }

		protected override void OnRedirectPageLoaded(Uri url, IDictionary<string, string> query, IDictionary<string, string> fragment)
		{
			//base.OnRedirectPageLoaded(url, query, fragment);

			var store = NSHttpCookieStorage.SharedStorage;
			var cookies = store.Cookies;
			var fedAuthList = cookies.Where(c => c.Name.ToLower().StartsWith("fedauth")).ToList();

			if(fedAuthList.Count>0)
			{
				var account = new Account();
				foreach(var fedAuth in fedAuthList)
				{
					account.Properties.Add(fedAuth.Name, fedAuth.Value);
				}
				OnSucceeded(account);
			}
		}
	}
}

And the view controller part

var loginUrl = manager.InitialLoginUrl;
			var redirectUrl = manager.RedirectLoginUrl;
			var auth = new FedAuthWebRedirectAuthenticator(new Uri(loginUrl), new Uri(redirectUrl));

			auth.Title = "";
			auth.AllowCancel = false;
			auth.Completed += async (object sender, AuthenticatorCompletedEventArgs e) =>
				{
					this.DismissViewController(true, null);
					if(!e.IsAuthenticated)
					{
						return;
					}

					var authManager = TinyIoCContainer.Current.Resolve<SDXAuthManager>();
					authManager.SetSecurityToken(e.Account.Properties);
					authManager.AuthenticationTime = DateTime.Now;
					authManager.IsAuthenticated = true;	
					
					//cache the auth tokens
					var storage = SimpleStorage.EditGroup("Sodexo");
					storage.Put<Dictionary<string,string>> ("Security Token", e.Account.Properties);
					storage.Put<DateTime> ("Login Data time limit", DateTime.Now);

				var userManager = TinyIoCContainer.Current.Resolve <SDXUserManager> ();
				if (userManager.Me == null)
				{
					await LoadMe();
				}

				//register for push notifications now that we're authenticated
				UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
				UIApplication.SharedApplication.RegisterForRemoteNotificationTypes (notificationTypes);

				};

			var vc = auth.GetUI();
			this.PresentViewController(vc, false, () => { this.PerformSegue("SegueToMain", this);  });
Comment 1 Sebastien Pouliot 2014-12-24 12:15:14 UTC
The setter for UIWebView.Delegate still exists in the unified API. However it's type was changed to accept the protocol (objc) / interface (.net).

You'll need an update to the Xamarin.Auth component that was build on top of the final unified API (the one in XI 8.6). Previous unified API (since XI 7.4) were previews.
Comment 2 Sergi Czerkasow 2015-01-06 08:46:45 UTC
I have the latest available component 1.2.3 and alpha channel xamarin studio, so in theory there is nothing more for me to update, yet the bug is still there..
Comment 3 Sebastien Pouliot 2015-01-06 09:42:06 UTC
I'm not sure about this specific* component status (most are updated) but AFAIK the component store only* supports the stable release (there's no stable/beta/alpha channels) which is still XI 8.4 (until next week).

* c.c. Bill for confirmation
Comment 4 Bill Holmes 2015-01-06 11:01:41 UTC
Sebastien is correct.  

The components in the store are based on the stable version of Xamarin.iOS.  We will release updated components as soon as Xamarin.iOS 8.6 is released to stable.