2017-11-18 99 views
-1

我開發了一個應用程序,使用xamarin.forms並僅在android上測試。我現在開始進行iOS測試,並將我使用的所有圖像從我的android資源可繪製文件夾複製到iOS資源文件夾。在模擬器上進行調試時,我的應用程序一直在打破:「System.ArgumentNullException已被拋出,值不能爲空。參數名稱:image。」System.ArgumentNullException xamarin.forms

我已經試過

  • 我調整我的所有影像複製到下面100KB。
  • 確保我在xaml中的所有圖像參考都以各自的 png或jpg結尾。

不知道還有什麼可能導致此異常。任何幫助將不勝感激。

的XAML頁面我無法瀏覽到

<?xml version="1.0" encoding="utf-8" ?> 
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
       x:Class="LoyaltyWorx.GridMenu" 
       BackgroundImage="grid.jpg" 
       Title="Main Menu" 
       > 
     <Grid> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="*" /> 
       <RowDefinition Height="2*" /> 
       <RowDefinition Height="*" /> 
      </Grid.RowDefinitions> 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition Width="1*" /> 
       <ColumnDefinition Width="2*" /> 
      </Grid.ColumnDefinitions> 
      <Label Text="Cards" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="0" Grid.Column="0" BackgroundColor="#1481BA" Opacity="0.5" x:Name="CardTile"/> 
      <Label Text="Transactions" TextColor="Black" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="0" Grid.Column="1" BackgroundColor="#ede890" Opacity="0.5" x:Name="TransactionTile"/> 
      <Label Text="Promotions" TextColor="White" FontSize="30" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="1" Grid.Column="0" BackgroundColor="#1481BA" Grid.ColumnSpan="2" Opacity="0.7" x:Name="PromoTile"/> 
      <Label Text="Settings" TextColor="Black" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="2" Grid.Column="0" BackgroundColor="#ede890" Opacity="0.5" x:Name="SettingsTile" /> 
      <Label Text="My Profile" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="2" Grid.Column="1" BackgroundColor="#1481BA" Opacity="0.7" x:Name="ProfileTile"/> 
     </Grid> 
    </ContentPage> 
+0

沒有人可以幫你沒有一行代碼 –

+0

我不好,檢查我的編輯 –

+0

如果你刪除BackgroundImage =「grid.jpg」是否有效? –

回答

0

你必須在依奧斯/資源的每個圖像文件的生成操作設置爲
「BundleResource」

對於Android的:
AndroidResource
(和Android的,它不會接受繪製文件夾中任何一種的子文件夾)