所以一些背景信息。我負責探索使用Xamarin編寫跨平臺原生應用程序。目前看來非常基本,我喜歡我正在閱讀的內容。我有我的Visual Studio 2015企業版設置和我的遠程mac配置在網絡上。我通過Visual Studio中的項目創建嚮導創建了一個跨平臺的本地應用程序。當我爲iOS應用程序啓動調試會話時,它會在遠程Mac上的模擬器中啓動目標應用程序。但是,它從來沒有真正認爲它正在運行。它將在這個輸出掛起:Xamarin嚮導項目不能調試
Launching 'PersonalProject.iOS' on 'iPhone 6 iOS 10.2'...
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/Xamarin.iOS.dll
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/System.dll
Thread started: #2
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/PersonalProject.iOS.exe
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/System.Xml.dll
最終,它會失敗,並沿着這些路線的東西:
The app has been terminated.
Launch failed. The app 'PersonalProject.iOS' could not be launched on 'iPhone 6 iOS 10.2'. Error: An error occurred while executing MTouch. Please check the logs for more details.
我檢查日誌文件有問題,它包含無非完全相同更多短語。
如果我嘗試把控制檯寫一個簡單的行上按下按鈕的動作:
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
Button.AccessibilityIdentifier = "myButton";
Button.TouchUpInside += delegate {
var title = string.Format ("{0} clicks!", count++);
Button.SetTitle (title, UIControlState.Normal);
Console.WriteLine(string.Format("{0} clicks!"));
};
}
調試會話居然就在Main.cs文件這一行17(UIApplication.Main)錯誤:
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace PersonalProject.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}
由於未處理的異常錯誤:
Unhandled Exception:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Error while resolving expression: One or more errors occurred.
如果我沒有的C鞋墊日誌它將啓動應用程序,但仍然掛在那些Loaded裝配線上。此時,我無法在代碼中打破任何斷點。我試着在按鈕點擊的共享代碼中添加一個斷點,但即使該操作正在由模擬器執行,它也不會觸及它。
我對如何繼續完全不知所措。我沒有觸及任何超出嚮導創建的範圍。我希望我至少能看到啓動項目的工作。
任何幫助表示讚賞。
此行缺少一個參數:Console.WriteLine(的String.Format(」 {0}點擊!「)); – Jason