you are calling a UIKit method that can only be invoked from the UI thread.
参考方案1:http://blog.csdn.net/joyhen/article/details/20471217
参考方案2:https://developer.xamarin.com/api/member/MonoTouch.Foundation.NSObject.BeginInvokeOnMainThread/p/MonoTouch.Foundation.NSAction/
// Invoked in response to a button clicked on the UI. void StartDownload () { status.Text = "Downloading file..."; ThreadPool.QueueUserWorkItem (BackgroundDownload); } // This is the background helper BackgroundDownload () { var wc = new WebClient (); wc.DownloadFile (myUrl, "/tmp/largeFile.txt"); // When the download is complete, notify the UI BeginInvokeOnMainThread (delegate { status.Text = "Download has been completed"; }); }
浙公网安备 33010602011771号