【发布时间】:2017-01-30 18:49:52
【问题描述】:
我的解决方案包括 3 个项目:
我的后端项目与程序集 My_Test_App(便携式)
My_Test_App.Android
My_Test_App.iOS
在后端项目中,我有这个 XAML 页面代码(请原谅名称)
<ContentPage
x:Class="My_Test_App.Pages.LoginPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:My_Test_App.Converters;assembly=My_Test_App"
xmlns:effects="clr-namespace:My_Test_App.Effects;assembly=My_Test_App"
xmlns:viewModels="clr-namespace:My_Test_App.ViewModels;assembly=My_Test_App"
xmlns:views="clr-namespace:My_Test_App.Views;assembly=My_Test_App">
<ContentPage.Resources>
<ResourceDictionary>
<converters:Converter1 x:Key="conv1" />
<converters:Converter2 x:Key="conv2" />
<converters:Converter3 x:Key="conv3" />
</ResourceDictionary>
</ContentPage.Resources>
</ContentPage>
它适用于 android 和 iPhone 模拟器,但是当我在真正的 iPhone 上测试它时,我得到了这个错误:
Xamarin.Forms.Xaml.XamlParseException: Position 13:14. Type converters:Converter1 not found in xmlns clr-namespace:My_Test_App.Converters;assembly=My_Test_App
我在后端项目中的 Converter1 代码:
namespace My_Test_App.Converters
{
public class Converter1: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool original = (bool)value;
return !original;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
public My_Test_App()
{
}
}
}
你能帮忙吗?我这里有几个嫌疑人:
程序集名称下划线,但我需要保留当前程序集名称..
在 IOS 项目属性中,我将 iOS 构建部分中的链接器选项从“仅链接 SDK”更改为“链接所有程序集”。但是,如果我不更改它,我会收到错误“Could not AOT the assembly.......”
当前 xamarin 版本中可能存在的错误(我的是 4.2.2.11)
谢谢你帮助我!
【问题讨论】:
标签: xamarin xamarin.forms