Я могу загружать и получать доступ к файлам resx в сборках Simulator моего приложения для iPhone, созданного с использованием MonoTouch.Запись файла resx в файле csproj выглядит следующим образом:
<ItemGroup>
<EmbeddedResource Include="MapMenu\Resources\MapMenu.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>MapMenu.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
Сам файл .resx имеет следующую запись:
<data name="Main_Menu" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Main Menu.mm;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
, а созданный файл MapMenu.Designer.cs имеетthis:
internal static string Main_Menu {
get {
return ResourceManager.GetString("Main_Menu", resourceCulture);
}
}
Как уже упоминалось выше, вызов средства доступа Main_Menu прекрасно работает на симуляторе.Однако на устройстве оно выдает:
<Notice>: Unhandled Exception: System.MissingMethodException: No constructor found for System.Resources.RuntimeResourceSet::.ctor(System.IO.UnmanagedMemoryStream)
<Notice>: at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
<Notice>: at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
<Notice>: at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
<Notice>: at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) [0x00000] in <filename unknown>:0
<Notice>: at System.Resources.ResourceManager.GetString (System.String name, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
<Notice>: at MapMenu.Resources.MapMenu.get_Main_Menu () [0x00000] in <filename unknown>:0
Сделал несколько проверок работоспособности, и мне интересно узнать, действительно ли в Monotouch отсутствует эта функция.
Спасибо,