Я работаю над примерами Monotouch/Xamarin и пытается сшить сценарную сцену и аутентификацию Windows Azure Mobile Services (WAMS). У меня есть работа независимо, но я просто не могу спровоцировать segue после действительного входа в WAMS. В функции DoLogin() не возникает ошибка, и AlertView работает. Кажется, что он пропускает PerformSegue. PerformSegue в ViewDidLoad() отлично работает.Monotouch iOS - PerformSegue от функции
public override void ViewDidLoad()
{
base.ViewDidLoad();
btn_Facebook.TouchUpInside += (sender, e) => {
Console.WriteLine("Facebook clicked");
DoLogin(MobileServiceAuthenticationProvider.Facebook);
};
btn_Twitter.TouchUpInside += (sender, e) =>
{
Console.WriteLine("Twitter clicked");
this.PerformSegue("seg_Login", this);
// DoLogin(MobileServiceAuthenticationProvider.Twitter);
};
}
private void DoLogin(MobileServiceAuthenticationProvider provider)
{
string applicationKey = "[removed]";
string applicationUrl = "https://[removed].azure-mobile.net/";
MobileServiceClient client = new MobileServiceClient(applicationUrl, applicationKey);
var task = client.LoginAsync(this, provider).ContinueWith(t =>
{
MobileServiceUser user = t.Result;
this.BeginInvokeOnMainThread(() =>
{
this.PerformSegue("seg_Login", this);
UIAlertView alert = new UIAlertView("Logged In!", string.Format("Hello user {0}", user.UserId), null, "OK");
alert.Show();
});
});
}
Спасибо за предложение. Я пытался просто нажать все на раскадровку с помощью PerformSegue, который, похоже, отлично работает в ViewDidLoad. Я принял ваш совет и внедрил PrepareForSegue с точкой останова. Он попадает в точку останова, но сейг никогда не срабатывает. –