Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Cannot debug project references through Visual Studio

$
0
0

Hi, I'm trying to port an existing code base currently running on Windows and Android to iOS.

I managed to set up everything so that I can debug my code via Visual Studio and build on a remote Mac, and it seems to be working correctly.

The solution has three main projects. Two libraries and the app. (There also are some other third party projects, but it's probably not relevant)

My problem is, I can debug (set breakpoints) from Visual Studio, but only in the startup project. The breakpoints in the projects other than the main one are never triggered. In fact, Visual Studio is telling me that "The breakpoint will not currently be hit. No symbols have been loaded for this document.". I spent a few hours trying different things (clearing the cache, checking the project configurations, checking the logs...) but I'm running out of ideas.

Everything is working fine on the Mac if I use Xamarin Studio. My breakpoints work whatever the project they are set in.

I didn't see similar problems after googling for a while, so here I am. Can anyone help?


ERROR WITH LATEST NUGET v2.5.0.77 "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded

$
0
0

I just got latest stable 2.5.0.77107 and I can't compile anymore

[myUser]\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.targets(55,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly [myUser]\.nuget\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

I replaced my user path with [myUser]

it looks like this bug exists since October in the pre-release:

https://bugzilla.xamarin.com/show_bug.cgi?id=60293

Cannot resolve symbol ResourceDictionary.MergedDictionaries

$
0
0

Hi,
I am following this tutorial and trying to implement a resource dictionary into my page.
developer xamarin com/guides/xamarin-forms/xaml/resource-dictionaries/
But when I put the <ResourceDictionary.MergedDictionaries> tag into the ContentPage, just like in the tutorial, It fails with the error "Cannot resolve symbol ResourceDictionary.MergedDictionaries".
Whan can I do to fix this?

Calling CCTileMapLayer.SetTileGID to change tilemap tile graphic causes app to hang

$
0
0

Hi,

I'm hosting a CocosSharp 1.7.1 game in Xamarin.Forms on Android. I'm using a hex map created using Tiled as my game board. The tile map loads fine and I can create sprites and add to the game layers. However, whenever I try to dynamically alter a tile graphic to use a different tile within the same tileset or even EmptyTile using CCTileMapLayer.SetTileGID the app hangs.

Any suggestions on how I can dynamically change the tile graphics or any ideas on what I'm doing wrong gratefully received.

Cheers, P.

NuGets not installing error

$
0
0

If I make a new project as a PCL and try to install certain NuGet packages (for example I'm trying CSVHelper and Xam.iTextSharpLGPL) I'll get the error message:

Could not install package 'CsvHelper 6.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

The package, however, will successfully install. But in the iOS project only.

If I make a new project as shared code, they will successfully install. I've tried changing the PCL profile to target fewer options but still have the same problems. I don't want to have to migrate my whole project to .NET standard at this point in time.

Visual Studio 2017 v15.4.5, Xamarin 4.7.10.38

Hardware requirement

$
0
0

I wanted to develop native application for iOS, Windows phone and Android platform using Visual Studio 2013/Xamarin. My question is: What is the hardware requirement for the development?

Custom Label renderer crashes due to NullReferenceException when removing items from ListView

$
0
0

Hi,

I'm experiencing a strange issue with my custom Label renderer. My custom renderer keeps crashing due to a NullReferenceException while disposing its instance. I'm gonna attach my custom renderer at the bottom of this text. I'll try to reproduce the issue in brief:

Case 1:

  • Create a ContentView and set my custom Label as its content.
  • Add the ContentView created above into a generic Layout (e.g. StackLayout).
  • Once the custom Label is instantiated, remove the whole ContentView from the generic Layout.
  • The custom Label renderer WON'T crash.

Case 2:

  • Create a ViewCell and set my custom Label as its content.
  • Create an ObservableCollection containing various instances of String type.
  • Set the ViewCell as ItemTemplate of a generic ListView.
  • Set the above ObservableCollection as ItemsSource.
  • Finally remove an item from the above ListView.
  • The custom Label renderer WILL crash.

I don't know how to solve this issue. Is there something related directly to the ListView? Why my custom Label renderer crashes only when it gets disposed from a ListView? My custom Label renderer does not override the Dispose() method of the LabelRenderer class. It's a very strange behaviour to me. Waiting for your help, thanks in advance.

CustomLabel

using MyProject.Helpers;
using Xamarin.Forms;

namespace MyProject.Renders
{
    public class CustomLabel : Label
    {
        #region LineSpacing
        public static readonly BindableProperty LineSpacingProperty = BindableProperty.Create(nameof(LineSpacing), typeof(float), typeof(CustomLabel), 1.1f);
        /// <summary>
        /// Gets or sets the extra spacing between lines of text, as a multiplier.
        /// </summary>
        public float LineSpacing
        {
            get => (float)GetValue(LineSpacingProperty);
            set => SetValue(LineSpacingProperty, value);
        }
        #endregion

        #region HasShadow
        public static readonly BindableProperty HasShadowProperty = BindableProperty.Create(nameof(HasShadow), typeof(bool), typeof(CustomLabel), false);
        /// <summary>
        /// Gets or sets whether the text should have a shadow.
        /// </summary>
        public bool HasShadow
        {
            get => (bool)GetValue(HasShadowProperty);
            set => SetValue(HasShadowProperty, value);
        }
        #endregion

        #region ShadowColor
        public static readonly BindableProperty ShadowColorProperty = BindableProperty.Create(nameof(ShadowColor), typeof(Color), typeof(CustomLabel), Color.Black);
        /// <summary>
        /// Gets or sets the shadow color of the text.
        /// </summary>
        public Color ShadowColor
        {
            get => (Color)GetValue(ShadowColorProperty);
            set => SetValue(ShadowColorProperty, value);
        }
        #endregion

        #region ShadowRadius
        public static readonly BindableProperty ShadowRadiusProperty = BindableProperty.Create(nameof(ShadowRadius), typeof(int), typeof(CustomLabel), 5);
        /// <summary>
        /// Gets or sets the shadow radius of the text.
        /// </summary>
        public int ShadowRadius
        {
            get => (int)GetValue(ShadowRadiusProperty);
            set => SetValue(ShadowRadiusProperty, value);
        }
        #endregion

        #region ShadowDistanceX
        public static readonly BindableProperty ShadowDistanceXProperty = BindableProperty.Create(nameof(ShadowDistanceX), typeof(int), typeof(CustomLabel), 5);
        /// <summary>
        /// Gets or sets the horizontal offset of the text shadow.
        /// </summary>
        public int ShadowDistanceX
        {
            get => (int)GetValue(ShadowDistanceXProperty);
            set => SetValue(ShadowDistanceXProperty, value);
        }
        #endregion

        #region ShadowDistanceY
        public static readonly BindableProperty ShadowDistanceYProperty = BindableProperty.Create(nameof(ShadowDistanceY), typeof(int), typeof(CustomLabel), 5);
        /// <summary>
        /// Gets or sets the vertical offset of the text shadow.
        /// </summary>
        public int ShadowDistanceY
        {
            get => (int)GetValue(ShadowDistanceYProperty);
            set => SetValue(ShadowDistanceYProperty, value);
        }
        #endregion

        #region Html
        public static readonly BindableProperty HtmlProperty = BindableProperty.Create(nameof(Html), typeof(bool), typeof(CustomLabel), false);
        /// <summary>
        /// Gets or sets whether the text should be rendered as HTML text.
        /// </summary>
        public bool Html
        {
            get => (bool)GetValue(HtmlProperty);
            set => SetValue(HtmlProperty, value);
        }
        #endregion

        #region FontName
        public static readonly BindableProperty FontNameProperty = BindableProperty.Create(nameof(FontName), typeof(string), typeof(CustomLabel), Utils.GetGeneralLightFont());
        /// <summary>
        /// Gets or sets the font name of the text. Does not require the font ".ttf" extension.
        /// </summary>
        public string FontName
        {
            get => (string)GetValue(FontNameProperty);
            set => SetValue(FontNameProperty, value);
        }
        #endregion

        #region FontSizeMultiplier
        public static readonly BindableProperty FontSizeMultiplierProperty = BindableProperty.Create(nameof(FontSizeMultiplier), typeof(float), typeof(CustomLabel), 1.0f);
        /// <summary>
        /// Gets or sets the extra custom font size, as a multiplier.
        /// </summary>
        public float FontSizeMultiplier
        {
            get => (float)GetValue(FontSizeMultiplierProperty);
            set => SetValue(FontSizeMultiplierProperty, value);
        }
        #endregion

        #region Padding
        public static readonly BindableProperty PaddingProperty = BindableProperty.Create(nameof(Padding), typeof(Thickness), typeof(CustomLabel), new Thickness(0));
        /// <summary>
        /// Gets or sets the inner padding.
        /// </summary>
        public Thickness Padding
        {
            get => (Thickness)GetValue(PaddingProperty);
            set => SetValue(PaddingProperty, value);
        }
        #endregion

        #region IsHeader
        public static readonly BindableProperty IsHeaderProperty = BindableProperty.Create(nameof(IsHeader), typeof(bool), typeof(CustomLabel), false);
        /// <summary>
        /// Gets or sets whether the text should be rendered as an header text with marquee ellipsize.
        /// </summary>
        public bool IsHeader
        {
            get => (bool)GetValue(IsHeaderProperty);
            set => SetValue(IsHeaderProperty, value);
        }
        #endregion

        #region MaxLines
        public static readonly BindableProperty MaxLinesProperty = BindableProperty.Create(nameof(MaxLines), typeof(int), typeof(CustomLabel), 0);
        /// <summary>
        /// Gets or sets the number of lines that CustomLabel should be tall.
        /// </summary>
        public int MaxLines
        {
            get => (int)GetValue(MaxLinesProperty);
            set => SetValue(MaxLinesProperty, value);
        }
        #endregion

        #region BreakMode
        public enum BreakMode { Start, End, None };
        public static readonly BindableProperty EllipsizeProperty = BindableProperty.Create(nameof(Ellipsize), typeof(BreakMode), typeof(CustomLabel), BreakMode.None);
        /// <summary>
        /// Gets or sets the ellipsize type.
        /// </summary>
        public BreakMode Ellipsize
        {
            get => (BreakMode)GetValue(EllipsizeProperty);
            set => SetValue(EllipsizeProperty, value);
        }
        #endregion
    }
}

[Android] CustomLabelRenderer

using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Android.Graphics;
using System.ComponentModel;
using Android.Util;
using Android.OS;
using Android.Text;
using static Android.Text.TextUtils;

using MyProject.Renders;
using MyProject.Droid.Renders;
using MyProject.Droid.Helpers;
using Android.Content;

[assembly: ExportRenderer(typeof(CustomLabel), typeof(CustomLabelRenderer))]
namespace MyProject.Droid.Renders
{
    class CustomLabelRenderer : LabelRenderer
    {
        CustomLabel @CustomLabel;
        int MarqueeRepeatLimit = -1; // INFINITE

        public CustomLabelRenderer(Context context) : base(context) { }

        protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null && e.NewElement != null)
            {
                @CustomLabel = (CustomLabel)e.NewElement;
                Initialize();
            }
        }

        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(CustomLabel.FontNameProperty.PropertyName))
                UpdateFont();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(Label.FontSizeProperty.PropertyName) ||
                e.PropertyName.Equals(CustomLabel.FontSizeMultiplierProperty.PropertyName))
                UpdateFontSize();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(CustomLabel.LineSpacingProperty.PropertyName))
                UpdateLineSpacing();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(CustomLabel.MaxLinesProperty.PropertyName))
                UpdateMaxLines();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(CustomLabel.EllipsizeProperty.PropertyName))
                UpdateEllipsize();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(CustomLabel.IsHeaderProperty.PropertyName))
                UpdateHeader();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(CustomLabel.HasShadowProperty.PropertyName) ||
                e.PropertyName.Equals(CustomLabel.ShadowDistanceXProperty.PropertyName) ||
                e.PropertyName.Equals(CustomLabel.ShadowDistanceYProperty.PropertyName) ||
                e.PropertyName.Equals(CustomLabel.ShadowColorProperty.PropertyName) ||
                e.PropertyName.Equals(CustomLabel.ShadowRadiusProperty.PropertyName))
                UpdateShadow();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(Label.TextProperty.PropertyName) ||
                e.PropertyName.Equals(CustomLabel.HtmlProperty.PropertyName))
                UpdateHtml();

            if (IsRendererAvailable() &&
                e.PropertyName.Equals(CustomLabel.PaddingProperty.PropertyName))
                UpdatePadding();
        }

        void Initialize()
        {
            UpdateFont();
            UpdateFontSize();
            UpdateLineSpacing();
            UpdateMaxLines();
            UpdateEllipsize();
            UpdateHeader();
            UpdateShadow();
            UpdateHtml();
            UpdatePadding();
        }

        void UpdateFont()
        {
            Control.Typeface = Typeface.CreateFromAsset(
                MainActivity.MainContext.ApplicationContext.Assets,
                $"{@CustomLabel.FontName}.ttf"
            );
        }

        void UpdateFontSize()
        {
            Control.SetTextSize(
                ComplexUnitType.Sp,
                (float)@CustomLabel.FontSize * @CustomLabel.FontSizeMultiplier
            );
        }

        void UpdateLineSpacing()
        {
            Control.SetLineSpacing(2.5f, @CustomLabel.LineSpacing);
        }

        void UpdateMaxLines()
        {
            if (@CustomLabel.MaxLines > 0)
                Control.SetMaxLines(@CustomLabel.MaxLines);
        }

        void UpdateEllipsize()
        {
            if (@CustomLabel.Ellipsize != CustomLabel.BreakMode.None)
                Control.Ellipsize = @CustomLabel.Ellipsize == CustomLabel.BreakMode.Start ?
                                    TruncateAt.Start : TruncateAt.End;
        }

        void UpdateHeader()
        {
            if (@CustomLabel.IsHeader)
            {
                Control.SetMaxLines(1);
                Control.Ellipsize = TruncateAt.Marquee;
                Control.SetMarqueeRepeatLimit(MarqueeRepeatLimit);
                Control.HorizontalFadingEdgeEnabled = true;
                Control.SetHorizontallyScrolling(true);
                Control.Focusable = true;
                Control.FocusableInTouchMode = true;
                Control.Selected = true;
            }
        }

        void UpdateShadow()
        {
            if (@CustomLabel.HasShadow)
                Control.SetShadowLayer(
                    @CustomLabel.ShadowRadius,
                    @CustomLabel.ShadowDistanceX,
                    @CustomLabel.ShadowDistanceY,
                    @CustomLabel.ShadowColor.ToAndroid()
                );
        }

        void UpdateHtml()
        {
            if (@CustomLabel.Html && !string.IsNullOrEmpty(@CustomLabel.Text))
            {
                ISpanned textFromHtml = default(ISpanned);
                #pragma warning disable CS0618
                if (Utils.IsAndroidVersionSatisfied(BuildVersionCodes.N))
                    textFromHtml = Html.FromHtml(@CustomLabel.Text, FromHtmlOptions.ModeLegacy);
                else textFromHtml = Html.FromHtml(@CustomLabel.Text);
                #pragma warning restore CS0618
                Control.Text = textFromHtml.ToString().Trim();
            }
        }

        void UpdatePadding()
        {
            Control.SetPadding(
                (int)@CustomLabel.Padding.Left,
                (int)@CustomLabel.Padding.Top,
                (int)@CustomLabel.Padding.Right,
                (int)@CustomLabel.Padding.Bottom
            );
        }

        bool IsRendererAvailable() => Control != null && Element != null && @CustomLabel != null;
    }
}

"Cannot access disposed object" - Error when PopAsync

$
0
0

I'm currently facing the ObjectDisposedException when I PopAsync from a Pagerenderer to another. Here how to recreate the error using 3 pages:

Page "A": the renderer contains Camera capture elements;
Page "B": containing UITextviews, Labels and Images;
Page "C": the renderer called "LocationSearchRenderer" contains a PageRenderer + UITableViewController + UISearchResultsUpdating for searching location with a search bar.

From PageRenderer "A" I PushAsync to Page "B". Then from PageRenderer "B" I PushAsync to Page "C".
After selecting a location inside tableview in PageRenderer "C", I PopAsync to Page "B" with code below

Action action = async () =>
{
    await App.Current.MainPage.Navigation.PopAsync();
};

DismissViewController(true, action);

so far everything works just fine.
BUT when I try to PopAsync from "B" to "A" with a simple Navigation.PopAsync() the app crashes with

ObjectDisposedException
"Cannot access disposed object".
Object name: 'LocationSearchRenderer'

I googled for days but nothing seems to work. Saw many bug reports on github - bugzilla - stackoverflow - xamarinForums but I didn't find any solution.
Below you can find the sample Page code for page A, B and C, if may be useful:

public class PageX : ContentPage
{
    RelativeLayout layout;
        public NavBar bar;

    public PostDetailPage()
    {
        NavigationPage.SetHasNavigationBar(this, false);
        this.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, App.HeightRes * 0.05);
            this.BackgroundColor = Color.Black;
        layout = new RelativeLayout();

        /// Create top bar.
            bool backButton = true;
                bool forwardButton = false;
                bar = new NavBar(backButton, forwardButton);
        bar.backButton.Clicked += BackButton_Clicked;

        /// Add bar to layout.
                ModelUtility.ConfigureSettingsLayout(layout, bar, null);

        /// Create Content.
        Content = layout;
    }

        async void BackButton_Clicked(object sender, EventArgs e)
        {
            await this.Navigation.PopAsync();
        }
}

I tried to move the PopAsync from Shared code to iOS but same result. The only thing that changed the result so far was using

await App.Current.MainPage.Navigation.PopAsync();

instead of

                            Action action = async () =>
                            {
                                await App.Current.MainPage.Navigation.PopAsync();
                            };

                            DismissViewController(true, action);

inside the Page "C". The crash from B to A didn't appear at first, but came out after the 2nd time I followed the path I described above.
Does anyone know a solution or workaround? Many thanks!!


'Core' does not exist in the namespace 'Xamarin.Forms'

$
0
0

Hello. I try to use MessageCenter in my PCL project, but I get this error.

I tried to reinstall Xamarin.Forms and deleted packages folder, but it does not give a good result.

What happened to PCL and UWP in VS 15.5.1?

$
0
0

I just updated Visual Studio to 15.5.1. When I tried to create a new project, the PCL option seems to be replaced by a .Net option. Is this the same? Also, the selection for UWP is grayed out. How do I get this option back?

I cant find the option to create a PCL Xamarin Forms, VS 2017 (v15.5) project.

$
0
0

So I have been running into massive problems with my main project. I keep getting the "ResolveLibaryProjectImports" error. So I decided to create a fresh Xamarin project for troubleshooting. And now I cant even create a PCL Xamarin Forms project!!!! I am just running into problem after problem, after problem with Xamarin Forms and VS 2017....

Xamarin Android Exception while loading assemblies: System.IO.FileNotFoundException: Could not load

$
0
0

Hello everyone, I am working on Shared Xamarin Forms project for iOS and Android. And android just stopped building at one point. I tried switching from mac to windows, installing Xamarin fresh and I still got the same error.

So far everything seemed to be OK. And then suddenly I cannot build debug or release on Android project. I am getting this error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Compat.dll'
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:220
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170
  at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <593a6fd557984367bb21e275d0fa0659>:0
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <593a6fd557984367bb21e275d0fa0659>:0

I am pretty sure I haven't changed any source files, it was building up until now.. The only App Compat I use is "Xamarin.Android.Support.v7.Compat".

The things I tried:

Removing all packages and adding them again.
Creating fresh Xamarin.Forms project and pulling code from git - same error
Installing Xamarin.Android.Support.Compat - Error I got:
You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework.
Made sure my target framework is same as target version (Use API 23) and my minimum target version is API 19.
Deleting Bin and Obj directories, restarting solution and building again.
I am using Xamarin.Forms 2.4.0.38779. I tried removing all packages and updating for the newest Forms - still got same error.

Facebook Share

$
0
0

Hi,

I need to implement FB share in my app (Xamarin Forms PCL) and I tryed really a lot of plugin and working for many days with no success.
Can you please share your experience on which is the best plugin to reach the goal and how to use it?

I need to implement bot on Android and iOS

Thank you a lot for your help!

RemoteControlReceived

$
0
0

How can I implement the iOS public override void RemoteControlReceived(UIEvent theEvent) in Forms? I'm building a PCL App which contains an audio player and must be able to receive events from the remote control.

Mac App rejected due to MapKit not being linked

$
0
0

My app was rejected from the Mac App Store for the following reason:
2.3 - Apps that do not perform as advertised by the developer will be rejected

The app still has the MapKit entitlement without linking against the MapKit framework.

My application targets the 64 bit architecture, links to the Native MapKit, associates the CFBundleIdentifier in Info.plist to the one created with Apple with Maps permissions. I am using the latest Stable releases of Xamarin.

Any thoughts on why this would happen?


Adding search bar to navigation bar in iOS 11

$
0
0

Has anyone been able to add a UISearchController to the navigation bar in iOS 11, when LargeTitles = true ? I can set the the NavigationItem.TitleView to a UISearchBar object, but it doesn't look good. Setting NavigationItem.SearchController to a UISearchController doesn't do anything; no search bar is displayed. Heres the code:

if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
{
    // doesn't work. No search bar is displayed
    var searchController = new UISearchController((UIViewController)null);
    navigationItem.SearchController = searchController;
    navigationItem.HidesSearchBarWhenScrolling = false;

    // This works, but doesn't look good (search bar is too small & overlaps the top part of the Large Title)
    // var searchBar = new UISearchBar();
    // ...
    // navigationItem.TitleView = searchBar;
}

Could not load assembly Xamarin.Android.Support.Fragment (Xamarin.Forms 2.5)

$
0
0

Hi,

I tried to upgrade to latest release of Xamarin.Forms v2.5.0.77107 (was before on v2.4.0.74863). It works properly for my iOS and shared projects but compilation fails for my Android project:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Fragment.dll'
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:220
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170
  at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <593a6fd557984367bb21e275d0fa0659>:0
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <593a6fd557984367bb21e275d0fa0659>:0  (LionsBase.Droid)

The Package section of my project does not have any reference to Xamarin.Android.Support.Fragment and if I try to add it manually, I get exception:

Could not install package 'Xamarin.Android.Support.Fragment 26.1.0.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Tried to choose an older release (24 or so) and error is similar.

My project is targeting Android 5.0 (API level 21) up to Android 7.0 (API level 24).

Tried to raise the maximum to Android 7.1 (API level 25) but it does not help.

ipa file installed only iphone 6 and 6s. same iPa file not working in iphone 7 and 5

$
0
0

I created iPa file from visual studio for mac and its installed in iphone 6s but same iPa file not working other iphone devices. Please help.

Documentation on how to find leaks using Profiler?

$
0
0

I need to find the source of some pretty consistent leaks we've got in our app.

I'm struggling to find a good description of how to use Profiler to identify the source of leaks. I've looked at:

https://xamarinhelp.com/tracking-memory-leaks-xamarin-profiler/
and
https://xamarinhelp.com/tracking-memory-leaks-xamarin-profiler-part-2/

http://www.c-sharpcorner.com/article/how-to-use-xamarin-profiler-with-visual-studio/

but these still leave a lot to be desired!

Given my understanding of Profile and Snapshots, I'd hope that I could:

  1. Run the app to a state with stable memory.
  2. Take snapshots until memory is stable (i.e. the number of new objects is 0) - Snapshot A
  3. Perform the operation I think is leaking.
  4. Take snapshots until memory is stable - Snapshot B

I was expecting to now be able to see which Objects are left behind since Snapshot A. However I'm afraid this isn't clear. The articles above indicate that it's the objects at Snapshot A which are 'Live' - but this would include lots of objects which we would expect to still be live - e.g. long-lived objects, surely.

Is there a good description of how to identify those Objects which have been left behind after performing my suspect leaking operation?

Buttons that Look like buttons

$
0
0

I am building my first Xamarin Forms app on VS Mac for primarily iOS deployment. I have a number of buttons in the app, but they are just text or they end up being background color. How can I make buttons that are pretty and look like buttons. I have downloaded many sample apps from GitHub and Xamarin, but all don't seem to have much good design to them. Does anyone know a free resource or a good sample app that is current.

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>