2017-02-14 7 views
0

그래서 일부 배경 정보. Xamarin을 사용하여 크로스 플랫폼 네이티브 응용 프로그램을 작성하는 방법을 모색하고 있습니다. 지금까지 꽤 기본적이고 나는 내가 읽고있는 것을 좋아합니다. Visual Studio 2015 Enterprise를 모두 설치하고 원격 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)의 오류 :

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가없는 경우 : 처리되지 않은 예외 오류와

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"); 
     } 
    } 
} 

onsole 로그는 앱을 시작하지만로드 된 어셈블리 라인에 여전히 매달린다. 이 시점에서, 나는 내 코드에서 어떤 중단 점을 칠 수 없다. 버튼 클릭에 대한 공유 코드에 중단 점을 추가하려고 시도했지만 시뮬레이터에서 수행 한 조치에도 불구하고 결코 충돌하지 않습니다.

나는 진행 방법을 완전히 잃었습니다. 나는 마법사 창조의 상자에서 무엇이든을 만지지 않았다. 나는 적어도 스타터 프로젝트가 작동하는 것을 볼 수 있기를 바랬다.

도움을 주시면 감사하겠습니다. 오류를 얻고있다 그 이유는,

+0

이 줄이 매개 변수가 없습니다 : Console.WriteLine (및 String.format (" {0} 클릭! ")); – Jason

답변

1
당신은

Console.WriteLine(string.Format("{0} clicks!"));

{0}를 사용하는

는 출력 값에 대한 자리 표시 자입니다,하지만 당신은 그 값을 지정하지 않습니다. 대신이 같은

사용 무언가 :

Console.WriteLine(string.Format("{0} clicks!", count));

또는 C#에서 6 구문 :

Console.WriteLine($"{count} clicks!");

+0

답변 주셔서 감사합니다. 왜 main.cs 파일에서 보여준 오류 대신에 그 행에 오류가 표시되지 않았습니까? – Kyle

+0

아니요, 죄송합니다. 앱이 자동으로 시작되지 않고 디버깅 할 수없는 경우 설정에 문제가있는 것으로 보입니다. 평소대로 해보십시오 : 재시작, 재설치, 재시도 :-) – Krumelur

관련 문제