2017-07-12 3 views
0

私は現時点で私の髪を切っています。私はプラグインから読み込むために非常に単純なビューを取得しようとしてきましたが、さまざまなエラーが続いています。私は最後の試みは私に次のエラーを与える:本当にそこMvvmCrossとXamarinを使って.xibをロードする

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" launchScreen="NO"> 
    <dependencies> 
     <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> 
     <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 
    </dependencies> 
    <objects> 
     <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PincodeViewController"> 
      <connections> 
       <outlet property="RootView" destination="7" id="name-outlet-7"/> 
      </connections> 
     </placeholder> 
     <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> 
     <viewController id="6"> 
      <layoutGuides> 
       <viewControllerLayoutGuide type="top" id="4"/> 
       <viewControllerLayoutGuide type="bottom" id="5"/> 
      </layoutGuides> 
      <view key="view" contentMode="scaleToFill" id="7"> 
       <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> 
       <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 
       <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> 
      </view> 
      <point key="canvasLocation" x="-407" y="-274"/> 
     </viewController> 
    </objects> 
</document> 

ないそこに多く:

'Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: -[UIViewController _loadViewFromNibNamed:bundle:] loaded the "PincodeView" nib but the view outlet was not set.'

ここ.xibです。私は単にViewControllerを追加しました。それだけです。ここで は、ファイルの所有者と.designer.cs

using MvvmCross.iOS.Views; 
using NN.Plugin.Utils.iOS.IOC; 
using NN.Plugin.Utils.ViewModels; 

namespace NN.Plugin.Utils.iOS 
{ 
    public partial class PincodeViewController : MvxViewController<PincodeViewModel> 
    { 
     public PincodeViewController() : base ("PincodeView", null) 
     { 
     } 

     public override void ViewDidLoad() 
     { 
      base.ViewDidLoad(); 
     } 
    } 
} 

// WARNING 
// 
// This file has been generated automatically by Visual Studio from the outlets and 
// actions declared in your storyboard file. 
// Manual changes to this file will not be maintained. 
// 
using Foundation; 
using System; 
using System.CodeDom.Compiler; 
using UIKit; 

namespace NN.Plugin.Utils.iOS 
{ 
    [Register ("PincodeViewController")] 
    partial class PincodeViewController 
    { 
     [Outlet] 
     [GeneratedCode ("iOS Designer", "1.0")] 
     UIKit.UIView RootView { get; set; } 

     void ReleaseDesignerOutlets() 
     { 
      if (RootView != null) { 
       RootView.Dispose(); 
       RootView = null; 
      } 
     } 
    } 
} 

だ私はFirstView.xib上のボタンを配置し、FirstViewModel.csでのICommandにそれをバインドしました。 FirstViewが正しく表示されます。ボタンをクリックすると上記のエラーが表示されます。 FirstView.xibのボタンにバインドされたICommandを持つFirstViewModel.csコードです。

using MvvmCross.Core.ViewModels; 
using NN.Plugin.Utils.ViewModels; 
using System.Windows.Input; 
using System; 

namespace PluginsTester.Core.ViewModels 
{ 
    public class FirstViewModel 
     : MvxViewModel 
    { 
     public override void Start() 
     { 
      base.Start(); 

      // ShowViewModel<PincodeViewModel>(); 
     } 

     string hello = "Hello MvvmCross"; 
     public string Hello 
     { 
      get { return hello; } 
      set { SetProperty(ref hello, value); } 
     } 

     public ICommand PinClicked 
     { 
      get => new MvxCommand(() => OpenPin()); 
     } 

     private void OpenPin() 
     { 
      ShowViewModel<PincodeViewModel>(); 
     } 
    } 
} 

私はこの一日中、まだ一歩進んでいません。 VS2017のクラッシュ/ハングとデザイナーが一日中私をあきらめていました。どんな助けもありがたい。

+0

github repoを作成できますか? – hugoterelle

+0

私は、別の解決策で問題を切り分けようとします。 –

+0

https://github.com/PaulSinnema/trunk –

答えて

1

問題はこれでした。私は間違った.xibを取った。 >空のユーザーインターフェイスとApple - - Appleとの間に差があるようです>表示

Select Project

レッスンがある:空のユーザーインターフェイスを使用しますが、ビューコントローラを使用しないでください。後者は、うまく動作する.csファイルと.xibファイルを作成します。

関連する問題