WebView is not working correctly in IOS MAUI

Shraddha Chauhan 0 Reputation points
2025-02-27T23:09:07.56+00:00

I have added a webview in my MAUI crossplateform app but I am not able to type in textbox or click on image buttons even pop up shows up but not able to even ok/cancel.

While working fine with Android,

Another issue with voice and video that is happening on both Android and IOS. I am using third party lib (LiveSwitch) to start local/remote media , code says its started but neither microphone work not camera is opening.

I am using MVVM framework and .Net 8.

Developer technologies | .NET | .NET MAUI
{count} votes

2 answers

Sort by: Most helpful
  1. Mubashar Hussain 0 Reputation points
    2025-02-28T12:33:50.0633333+00:00

    I have same issue with Maui WebView is not working on IOS; But working Fine with Android


  2. Ricardo Gomez 0 Reputation points
    2025-07-29T16:48:28.8033333+00:00

    @Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) rendering html in iOS platform has never worked in .net maui.
    Here is an example using .NET 9, iPhone 14 (iOS 18.5), VS2022 Version 17.14.7

    1. XAML snippet <ContentPage.Content>
      <ScrollView Padding="{OnIdiom Tablet='40, 10', Phone={OnPlatform Android='15, 15, 10, 0', iOS='20, 15, 15, 0'}}" VerticalOptions="Fill">
      
          <Grid>
      
              <Grid.RowDefinitions>
      
                  <RowDefinition Height="40"/>
      
                  <RowDefinition Height="*"/>
      
                  <RowDefinition Height="*"/>
      
                  <RowDefinition Height="60"/>
      
                  <RowDefinition Height="*"/>
      
                  <RowDefinition Height="100"/>
      
              </Grid.RowDefinitions>
      
              <Label HorizontalOptions="Start" Margin="0,0,0,5" Grid.Row="0"
      
                     Text="{mx:Localize TesterResults}"
      
                     FontSize="{StaticResource FontSizeLarge}"
      
                     VerticalTextAlignment="Center" />
      
              <StackLayout BindableLayout.ItemsSource="{Binding TesterResultList, Mode=TwoWay}" 
      
                        BackgroundColor="{StaticResource separatorColor}" Grid.Row="1"
      
                       Margin="2,2,2,2"
      
                       x:Name="testerResultListStackLayout">
      
                  <BindableLayout.ItemTemplate>
      
                      <DataTemplate>
      
                          <Grid HorizontalOptions="Start" RowSpacing="90" Margin="0,0,0,0">
      
                              <Grid.ColumnDefinitions>
      
                                  <ColumnDefinition Width="{OnIdiom Tablet='150', Phone='90'}"/>
      
                                  <ColumnDefinition Width="*" />
      
                              </Grid.ColumnDefinitions>
      
                              <Grid.RowDefinitions>
      
                                  <RowDefinition Height="Auto"/>
      
                              </Grid.RowDefinitions>
      
                              <BoxView Grid.Row="0" Grid.Column="0" VerticalOptions="End" BackgroundColor="White" HeightRequest="1"/>
      
                              <Label Grid.Row="0" Grid.Column="0" TextColor="{StaticResource blackTextColor}"
      
                                     Margin="2,2,0,0" 
      
                                     FontSize="{OnPlatform Android='17',iOS='16'}"
      
                                     LineBreakMode="WordWrap"
      
                                     FontAttributes="Bold"
      
                                     VerticalOptions="Start"
      
                                     HorizontalOptions="Start"
      
                                     Text="{Binding Title}"/>
      
                              <OnPlatform x:TypeArguments="View" >
      
                                  <On Platform="Android">
      
                                      <WebView HeightRequest="40"                                                
      
                                              Grid.Column="1" 
      
                                              Grid.Row="0"  
      
                                              HorizontalOptions="Start"
      
                                              VerticalOptions="Start">
      
                                          <WebView.Source>
      
                                              <HtmlWebViewSource Html="{Binding Description}"/>
      
                                          </WebView.Source>
      
                                      </WebView>
      
                                  </On>
      
                                  <On Platform="iOS">
      
                                      <StackLayout Grid.Row="0" BackgroundColor="{StaticResource dataGridBackgroundColor}"
      
                                             Grid.Column="1">
      
                                          <Label Grid.Row="0"
      
                                             Grid.Column="1"
      
                                             FontSize="17"
      
                                             TextColor="{StaticResource blackTextColor}"
      
                                             LineBreakMode="WordWrap"
      
                                             HorizontalOptions="Start"
      
                                             Text="{Binding Description}"
      
                                             VerticalOptions="Start"
      
                                             VerticalTextAlignment="Start" 
      
                                             TextType="Html"/>
      
                                      </StackLayout>
      
                                  </On>
      
                              </OnPlatform>
      
                          </Grid>
      
                      </DataTemplate>
      
                  </BindableLayout.ItemTemplate> 
      
              </StackLayout>
      
    2. Description & Title data (Use a view model for binding):
      Title= "Caution"
      	Description=	"<!DOCTYPE html><html><body style="font-size:16px"><p>The battery is still serviceable however, it does have decreased capacity and may not start the vehicle or may fail under extreme climate conditions.</p></body></html>"
      
      	Title=	"Recharge & Retest"
      
      	Description=	"<!DOCTYPE html><html><body style="font-size:16px"><p>The battery may be too severely discharged to determine the condition of the battery. Possible reasons:</p><ol><li><b>Loads left on: </b>Were there any lights left on, doors left open, or accessories plugged in for an extended time?</li><li><b>Vehicle storage: </b>Has the vehicle been sitting for over 90 days without a battery tender hooked up?</li><li><b>Options:</b><ul style="list-style-type: square;"><li>Take vehicle to a Club Owned Repair or Approved Auto Repair facility and have the battery professionally charged and retested.</li><li>Install the correct AAA/CAA Premium Battery at a competitive price with a 3-year warranty.</li></ul></li></ol></body></html>"
      
      	Title=	"Bad and Replace"
      
      	Description=	   "<!DOCTYPE html><html><body style="font-size:16px"><p>Battery has reached its end of life and replacement of battery is recommended.</p><ol><li><b>Age of the battery: </b>If over three years old, replacement is recommended.</li><li><b>Battery condition: </b>If corrosion is located on the battery posts or around the rim of the battery it is possible the battery is at its end of life.</li><li><b>State of Health: </b>A low State of Health determination from the tester means the battery will not recover to normal operation even with a professional charge.</li><li><b>Options:</b><ul style="list-style-type: square;"><li>Install the correct AAA/CAA Premium Battery at a competitive price with a 3-year warranty.</li></ul></li></ol></body></html>"  
      
    3. Page in Android Phone
      User's image
    4. Same page in iPhone 14 (iOS 18.5) - html formatting is gone:
      User's image

    Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.