主页带有系统



我每当尝试在模拟器上启动拍照的模拟器上的页面时就会得到一个系统。每当我尝试使用仿真器的相机拍摄照片时,我都会被带到启动用户界面的Xamarin Studio项目中的主页。我有错误:

system.notimplemplededException已抛弃

此功能未在此汇编的便携式版本中实现。您应该从主要应用程序项目中引用Nuget软件包,以引用特定于平台的实现。

这是代码:

using UIKit;
namespace Relate.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");
        }
    }
}

任何人可以帮忙吗?

这是相机的代码。我在项目中添加了媒体插件。

using System;
using Relate.Model;
using Xamarin.Forms;
using Plugin.Media;
namespace Relate.Views
{
    public partial class EditMemberPage : ContentPage
    {
        public EditMemberPage()
        {
            InitializeComponent();
            saveButton.Clicked += async (sender, args) =>
            {
                  if (CrossMedia.Current.IsCameraAvailable && 
CrossMedia.Current.IsTakePhotoSupported)
                  {
                      // Supply media options for saving our photo after 
it's taken.
                      var mediaOptions = new 
Plugin.Media.Abstractions.StoreCameraMediaOptions
                      {
                          Directory = "Receipts",
                          Name = $"{DateTime.UtcNow}.jpg"
                      };
                      // Take a photo of the business receipt.
                      var file = await 
CrossMedia.Current.TakePhotoAsync(mediaOptions);
                  }
              };
        }
        async void SaveButton_OnClicked(object sender, EventArgs e)
        {
            var famMemberItem = (FamMember)BindingContext;
            await App.Database.SaveFamMemberAsync(famMemberItem);
            await Navigation.PopAsync();
        }
    }
}

答案应该解释为什么这对您不起作用:https://forums.xamarin.com/discussion/93536/error-while-while-while-while-accessing-camera

您无法使用便携式公共库访问平台特定功能。如果要访问模拟器相机,则必须使用媒体插件之类的东西 https://github.com/jamesmontemagno/mediaplugin

最新更新