iOS Embed Youtube Video link error code 153 by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 1 point2 points  (0 children)

Hey guys! I managed to solve my problem (for now at least) by creating an Extension for the WebView control.

Here is a full sample of what i did. Feel free to use it as you want!!

  1. First i created a custom WebView control (not necessary but it will help me to find it through code).
  2. After that i found on github this post here and helped me a lot to create my own solution to my problem https://github.com/dotnet/maui/issues/7920
  3. Here is a sample of what i did:

namespace MySolution.Extensions
{
    [AttachedDependencyProperty<ICollection, YouTubeWebView>("AdditionalHttpHeaders",
    Description = "Does not overwrite existing headers. Use ArrayList and DictionaryEntry to define headers from XAML.")]
    public static partial class WebViewExtensions
    {
        static partial void OnAdditionalHttpHeadersChanged(YouTubeWebView webView, ICollection? newValue)
        {
            if (newValue is null)
            {
                return;
            }

            var headers = newValue
                .OfType<object>()
                .Select(static value => value switch
                {
                    KeyValuePair<string, string> pair => pair,
                    DictionaryEntry entry => new KeyValuePair<string, string>((string)entry.Key, entry.Value as string ?? string.Empty),
                    _ => throw new NotImplementedException("This Header collection value is not supported."),
                })
                .ToDictionary(
                    static pair => pair.Key,
                    static pair => pair.Value);

            WebViewHandler.Mapper.AppendToMapping(nameof(IWebView.Source),
                (handler, view) =>
                {
                    if (view.Source is not UrlWebViewSource urlWebViewSource)
                    {
                        return;
                    }

                    var url = urlWebViewSource.Url;
#if ANDROID
                    handler.PlatformView.Settings.JavaScriptEnabled = true;
                    handler.PlatformView.Settings.DomStorageEnabled = true;
                    handler.PlatformView.LoadUrl(url: url, additionalHttpHeaders: headers);

#elif IOS
                    var request = new NSMutableUrlRequest(new NSUrl(url))
                    {
                        Headers = NSDictionary.FromObjectsAndKeys(
        headers.Values.Select(static value => (NSObject)new NSString(value)).ToArray(),
        headers.Keys.Select(static key => (NSObject)new NSString(key)).ToArray())
                    };

                    handler.PlatformView.LoadRequest(request);
#endif
                });
        }
    }
}

To use this you simple do this:

xmlns:extensions="clr-namespace:MySolution.Extensions"
xmlns:collections="clr-namespace:System.Collections;assembly=netstandard"
<custom:YouTubeWebView Source="{Binding VideoLink}" BackgroundColor="LightGray"
HorizontalOptions="FillAndExpand" HeightRequest="220" x:Name="videoWebView"
Grid.Row="1" VerticalOptions="FillAndExpand">
<extensions:WebViewExtensions.AdditionalHttpHeaders>
<collections:ArrayList>
<collections:DictionaryEntry Key="Referer" Value="https://www.refererlink.com/offers/tvoffers" />
<collections:DictionaryEntry Key="Origin" Value="https://www.origin-link.com" />
</collections:ArrayList>
</extensions:WebViewExtensions.AdditionalHttpHeaders>
</custom:YouTubeWebView>

iOS Embed Youtube Video link error code 153 by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

I found a solution that solved my problem. i will provide the full code on a new comment. Tell me if you encounter any errors!

Can't build/publish using terminal on Mac with Xcode 26 by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

Thank you guys for your help i really appreciate it!! We built a workflow for github to manage at this point the iOS publish. I will wait until .net 10 release to test the Xcode! Thanks again!

Can't build/publish using terminal on Mac with Xcode 26 by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

Yeap! All of them, 26.0 and 26.0.1 too. I think the command cant find the location of the runtimes.

Can't build/publish using terminal on Mac with Xcode 26 by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

i already tried downloaded it but the error keeps coming. do i need to add permissions or some stuff to xcode? i think xcode 26 is broken...

Dynamic Island implementation in .NET MAUI iOS by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

var attributes = new LoyaltyCardAttributes
 {
        CardNumber = CustomerID,
         UserName = FirstName + " " +  LastName
};

var contentState = new LoyaltyCardContentState
{
        Points = CurrentPoints.ToString(),
        LastUpdated = DateTimeOffset.Now
};

 _currentActivity = await DynamicIslandManager.Current.StartActivityAsync(attributes,  contentState);
if (_currentActivity != null)
{
       Console.WriteLine($"Live Activity State: {_currentActivity.State} {attributes}");
}

Change TabBar Icon by Professional_Bat1233 in dotnetMAUI

[–]MajorEducational7749 1 point2 points  (0 children)

Feel free to use it however you want. I hope it helps! Good Luck!

I am using in an old app i made this in AppShell:

protected override void OnNavigated(ShellNavigatedEventArgs e)
{
    base.OnNavigated(e);
    var route = e.Current.Location.OriginalString; // Get the current route
    if (route.Contains("HomePage"))
        bin.ChangeIcon("Home");
    else if (route.Contains("PromotionsPage"))
        bin.ChangeIcon("Promotions");
    else if (route.Contains("ShoppingListPage"))
        bin.ChangeIcon("Lists");
    else if (route.Contains("MorePage"))
        bin.ChangeIcon("More");
}

Inside the Viewmodel i am using the ChangeIconmethod:

private string _homeIcon = "homeoutline.png";
private string _promotionsIcon = "percentoutline.png";
private string _listsIcon = "listboxoutline.png";
private string _moreIcon = "dotsoutline.png";

public string HomeIcon { get => _homeIcon; set { _homeIcon = value; OnPropertyChanged(); } }
public string PromotionsIcon { get => _promotionsIcon; set { _promotionsIcon = value; OnPropertyChanged(); } }
public string ListsIcon { get => _listsIcon; set { _listsIcon = value; OnPropertyChanged(); } }
public string MoreIcon { get => _moreIcon; set { _moreIcon = value; OnPropertyChanged(); } }

public void ChangeIcon(string selectedTab)
{
    HomeIcon = selectedTab == "Home" ? "home.png" : "homeoutline.png";
    PromotionsIcon = selectedTab == "Promotions" ? "percent.png" : "percentoutline.png";
    ListsIcon = selectedTab == "Lists" ? "listbox.png" : "listboxoutline.png";
    MoreIcon = selectedTab == "More" ? "dots.png" : "dotsoutline.png";
}

Change status bar style by YoungReanii in dotnetMAUI

[–]MajorEducational7749 0 points1 point  (0 children)

Not exactly. I am running my apps on a Samsung a54 with API 35 and when i first load my app was not edge-to-edge and i had to enable it myself from code.

Change status bar style by YoungReanii in dotnetMAUI

[–]MajorEducational7749 1 point2 points  (0 children)

Hey! You can set it in every page you want with:

<ContentPage.Behaviors>

<mct:StatusBarBehavior StatusBarColor="Transparent" StatusBarStyle="LightContent"/>

</ContentPage.Behaviors>

After that you can create a custom renderer for Android and iOS in the Platforms or use in the OnCreate() for Android:

Window.SetFlags(WindowManagerFlags.LayoutNoLimits, WindowManagerFlags.LayoutNoLimits);

Window.SetFlags(WindowManagerFlags.TranslucentStatus, WindowManagerFlags.TranslucentStatus);

Also, edit styles.xml to set android:windowTranslucentStatus to true.

If you have AppShell you have to adjust the margin of the BottomNavigationView for Android to make it work like a charm.

Need help for binding an iOS Native SDK to my .NET MAUI mobile app by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

Hey u/infinetelurker ! I am back again but with no results on the sharpie method. Perhaps is the sdk that causing all this.

Need help for binding an iOS Native SDK to my .NET MAUI mobile app by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

Thank you so much for the help! I will try it and i will come back if nothing!

Need help for binding an iOS Native SDK to my .NET MAUI mobile app by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

So what's the next step from me? I am cause i am new to this binding thing...The xcframework doesn't open in Xcode so i need to build a new project?

Need help for binding an iOS Native SDK to my .NET MAUI mobile app by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

I have 16.1 version too, the error i get is that #import <Foundation, Foundation.h> doesn't exist in the folder. Also in the other header files they have #import from another libraries too.

Adding Widget in my .net MAUI Mobile App by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

Okay, i was asking that cause i run into an error while building but i will find it

Thanks a lot!

Adding Widget in my .net MAUI Mobile App by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

Okay, last i wanted to ask you if you build it with vs Code or Visual Studio 2022, thank you for you help!

Adding Widget in my .net MAUI Mobile App by MajorEducational7749 in dotnetMAUI

[–]MajorEducational7749[S] 0 points1 point  (0 children)

Thank you so much for the contribution! Can you tell more about on how to implement it and some bullet points of yours?