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

Apple rejected my app for use of non-public APIs

$
0
0
  1. 5 Performance: Software Requirements
    Guideline 2.5.1 - Performance - Software Requirements

Your app uses or references the following non-public APIs:

  • LinkPresentation.framework
  • QuickLookThumbnailing.framework

The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.

Continuing to use or conceal non-public APIs in future submissions of this app may result in the termination of your Apple Developer account, as well as removal of all associated apps from the App Store.

I don't reference these in my solution at all. I've used the otool and strings tools to try and figure out where these frameworks are being used, but I can't seem to pinpoint them.

I've tested with an IPA file compiled with Don't Link and I got
Binary file MyApp.iOS matches
Binary file Xamarin.iOS.dll matches
while with an IPA compiled with Link Framework SDKs Only I got
Binary file MyApp.iOS matches
So I have a feeling it has something to do with the way the Xamarin.Forms package is compiled.

I've also updated all the packages just in case. The app has been in store for a while now and I've never encountered this issue before.

Am I missing something? Has anyone hit this roadblock before?

Included Packages:

My Project Options:


MessagingCenter.Unsubscribe occasionally fails to unsubscribe

$
0
0

Is there a situation where calling Unsubscribe can fail?

I have an application which listens for connection then allows the remote to register as a remote monitor. Any status updates will then be sent to this monitor using the MessagingCenter.

The monitor "RemoteMonitor" creates a subscription to a message within it's constructor and removes this subscription when the underlying connection is disconnected. For test purposes the remote is creating many connections (50 ish) then being disconnected and a status update is being sent to detect the disconnections.

`internal RemoteMonitor(string id, HttpConnection sourceConnection) : base("remotemonitor", MappedObjectType.NotSerialisable)
    {
        Log.GetInstance().WriteInfo(GetType(), "{" + UId.ToString() +"} Adding remote monitor to parent conId{" + m_sourceConnection.UId + "}"); 
        m_sourceConnection.ConnectionClosed += M_sourceConnection_ConnectionClosed;
        MessagingCenter.Subscribe<StatusMap>(this, MessageStrings.MedaiPlayerStatusChanged, (sender) => SendStatus(sender));
    }

private void M_sourceConnection_ConnectionClosed()
    {
        Log.GetInstance().WriteInfo(GetType(), "{" + UId.ToString() + "} Removing remote monitor from parent conId{" + m_sourceConnection.UId + "}");
        MessagingCenter.Unsubscribe<StatusMap>(this, MessageStrings.MedaiPlayerStatusChanged);
    }`

Looking at the log we can see that connection closed has been called for this instance
RemoteMediaPlayer.Models.Map.RemoteMonitor(13500): {37} Removing remote monitor from parent conId{36}

And only one instance of the Subscription was ever created
RemoteMediaPlayer.Models.Map.RemoteMonitor(13500): {37} Adding remote monitor to parent conId{36}

Yet SendStatus continues to be called

Android version 4.4.2
Xamarin Forms 4.6.0.726

HtmlLabelConverter with multiple links not working.

$
0
0

Adam Pedley posted a nice solution for converting html to a Label https://xamarinhelp.com/hyperlink-in-xamarin-forms-label/?utm_campaign=Weekly+Xamarin&amp;utm_medium=email&amp;utm_source=Weekly_Xamarin_166.

I extended the converter a bit and remove some bugs. It now also converts bold and italic tags as well as br and p-tag. The problem I run into is that when there are multiple links the click gesture does not work. It only works when there is 1 link.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Input;
using Xamarin.Forms;

namespace LuisterrijkApp
{
    public class HtmlLabelConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Label label = null;  // label is used to set the FontSize for Bold and Italic
            if (parameter is Label) 
            {
                label = (Label)parameter;
            }

            var formatted = new FormattedString();

            foreach (var item in ProcessString((string)value))
            {
                if (item.Type == "b") 
                {
                    formatted.Spans.Add(CreateBoldSpan(item, label));
                }
                else
                if (item.Type == "i")
                {
                    formatted.Spans.Add(CreateItalicSpan(item, label));
                }
                else
                {
                    formatted.Spans.Add(CreateAnchorSpan(item));
                }
            }

            return formatted;
        }

        private Span CreateAnchorSpan(StringSection section)
        {
            var span = new Span()
            {
                Text = section.Text
            };

            if (!string.IsNullOrEmpty(section.Link))
            {
                span.GestureRecognizers.Add(new TapGestureRecognizer()
                {
                    Command = _navigationCommand,
                    CommandParameter = section.Link
                });
                span.TextColor = Color.Blue;
                // Underline coming soon from https://github.com/xamarin/Xamarin.Forms/pull/2221
                // Currently available in Nightly builds if you wanted to try, it does work :)
                // As of 2018-07-22. But not avail in 3.2.0-pre1.
                // span.TextDecorations = TextDecorations.Underline;
            }

            return span;
        }

        private Span CreateBoldSpan(StringSection section, Label label)
        {
            var span = new Span()
            {
                Text = section.Text,
                FontAttributes = FontAttributes.Bold
            };
            if (label != null)
            {
                span.FontSize = label.FontSize;
            }

            return span;
        }

        private Span CreateItalicSpan(StringSection section, Label label)
        {
            var span = new Span()
            {
                Text = section.Text,
                FontAttributes = FontAttributes.Italic
            };
            if (label != null)
            {
                span.FontSize = label.FontSize;
            }

            return span;
        }

        public IList<StringSection> ProcessString(string rawText)
        {
            rawText = rawText.Replace("<br>", "\n");
            rawText = rawText.Replace("<br/>", "\n");
            rawText = rawText.Replace("<br />", "\n");
            rawText = rawText.Replace("<p>", "\n");
            rawText = rawText.Replace("</p>", "\n");
            const string spanPattern = @"(<[abi].*?>.*?</[abi]>)";

            MatchCollection collection = Regex.Matches(rawText, spanPattern, RegexOptions.Singleline);

            var sections = new List<StringSection>();

            var lastIndex = 0;

            foreach (Match item in collection)
            {
                var foundText = item.Value;
                sections.Add(new StringSection() { Text = rawText.Substring(lastIndex, item.Index - lastIndex) });
                lastIndex = item.Index + item.Length;

                var html = new StringSection()
                {
                    Link = Regex.Match(item.Value, "(?<=href=\\\")[\\S]+(?=\\\")").Value,
                    Text = Regex.Replace(item.Value, "<.*?>", string.Empty),
                    Type = item.Value.Substring(1,1)
                };

                sections.Add(html);
            }

            sections.Add(new StringSection() { Text = rawText.Substring(lastIndex) });

            return sections;
        }

        public class StringSection
        {
            public string Text { get; set; }
            public string Link { get; set; }
            public string Type { get; set; }
        }

        private ICommand _navigationCommand = new Command<string>((url) =>
        {
            Device.OpenUri(new Uri(url));
        });

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }}

ActivityIndicator does not show AT ALL

$
0
0

I want to use a ActivityIndicator, basically for asynchronous actions to a server in a MVVM setup. I am trying that for the first time, it just won't go.

Now a lot could be wrong, but even in the SIMPLEST way it does not show AT ALL. I can see space is reserved on screen, but it stays invisible.
<ActivityIndicator Color="Black" IsVisible="True" IsRunning="True" IsEnabled="True" VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="25" WidthRequest="25"/>
I have looked around on the web for any explanation or solution. But I gave up.

Is this a bug?

I have got Xamarin 4.2.2.11, Xamarin.Android 7.0.2.42.
Everything is up to date as far as I know.

Xamarin.Mac Image Resize

$
0
0

Hello.
I created the Xamarin.mac cocoa application. I want to resize a photo on disk. I want to send my photo to the server. service is waiting for me in byte array type. I found a few SDKs. I was only able to run the SkiaSharp sdk. this sdk reduced the quality of the photo. Is there a sdk that I can resize with xamarin.mac cocoa app. Thank you to everyone already.

Is it possible to use SQLLite (or any other DB) instance on PC and not Emulator

$
0
0

I believe it must be the most common requirement during development that one will need to make frequent changes to database and models etc. What I am looking for is that how I can use a local instance of a database on my desktop and not from emulator. I mean do I really have to copy time and again. I thought we will have a straight forward technique where the database will reside on my desktop. I will develop against this database and once done I will use adb shell to copy it to emulator and finally deploy it.

ListView Not Scrollable

$
0
0

I have a layout with a listview and below it a "toolbar" I want the list to be scrollable i Used verticaloptions="fillandExpand" but doesn't help

The following is my layout

<?xml version="1.0" encoding="utf-8"?>


    <Toolbar
        android:id="@+id/toolbar_bottom"
        android:minHeight="?android:attr/actionBarSize"
        android:background="?android:attr/colorAccent"
        android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
        android:popupTheme="@android:style/ThemeOverlay.Material.Light"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"/>

Looking foward to your kind help :)

Regards

M.R

CollectionView: System.MissingFieldException Field not found

$
0
0

Hello,
I've got System.MissingFieldException with CollectionView.
Exception message: System.MissingFieldException: 'Field not found: int .Style.AppCompatDialogStyle Due to: Could not find field in class'

Error occures when app goes to LoadApplication(new App()) in MainActivity Android class. In App class I have only setting MainPage to Page which contains CollectionView.
CollectionView is declared in XAML:

<CollectionView ItemsSource="{Binding TripList}">
                <CollectionView.ItemsLayout>
                    <GridItemsLayout Orientation="Vertical"
                        Span="2" />
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <ImageButton 
                                    Clicked="Trip_Clicked"
                                    CommandParameter="{Binding ID}"
                                    Source="{Binding ImageURL}"
                                    BackgroundColor="Transparent"
                                    HeightRequest="100"
                                    WidthRequest="125"
                                    Margin="0,15,0,0"/>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

TripList is List of my objects which contains ImageURL as string, and ID as GUID.

When I delete CollectionView from my Page, app starts without any error, but I need that. Additional, sometimes CollectionView works without any problem, but problem returns after uninstalling app.

Screenshot of exception:

More info:
Xamarin.Forms ver. 4.6.0.800
Xamarin.Android.* ver. 28.0.0.3
.NET Standard 2.0
API Level 28


Expander is throwing error

$
0
0

Hi,

I am trying to use Expander View in one of my ContentPage but I am getting this error.

XLS0414 The type 'Expander' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built

I have also added this line in App.cs

Device.SetFlags(new string[] { "Expander_Experimental" });

CollectionView ScrollTo not working properly

$
0
0

I have horizontal CollectionView which have 30 items. If I put collectionview.ScrollTo(15) then it scrolls to the end of the collectionview instead of 15th index.

TEditor richtextbox not working

$
0
0

Hello guys i am trying to use https://github.com/SymplastLLC/TEditor
Is working on xamarin froms last release
This how i am trting to fire him but it is not working

 async private void Button_Clicked(object sender, EventArgs e)
        {
           await ShowTEditor();
        }

        async Task ShowTEditor()
        {
            TEditorResponse response = await CrossTEditor.Current.ShowTEditor("<p>XAM consulting</p>");
            if (!string.IsNullOrEmpty(response.HTML))
            {
                _displayWebView.Source = new HtmlWebViewSource() { Html = response.HTML };
            }
        }

March 19th 2020 - Minneapolis, MN - Machine Learning 101

$
0
0

Join us for our March event sponsored and hosted by ILM Professional Services. This is a FREE event and a great opportunity for networking and the latest insights in mobile development.

RSVP Here: Minnesota Enterprise Mobile on Meetup

March Topic - Machine Learning 101

What do self-driving cars, email spam filters, and online recommendation offers all have in common? They all involve machine learning! It's at the forefront of analyzing and making decisions based on large amounts of data.

In this presentation, we'll introduce the basics of machine learning, talk about common applications, and walk through some examples and algorithms. Demos and code examples will be in C# using ML.Net.

Presented by Mark Kalal
Mark is a software development and IT professional, father of three, and technology enthusiast.

About the Group
Led by local developers, the Minnesota Enterprise Mobile User Group is a place to come together to share knowledge, experiences, and lessons learned with the development community regarding enterprise mobile development, with a focus on mobile cross-platform application development and the Xamarin toolset. Our goal is to cover all areas of the Enterprise Mobile landscape.

Thursday, March 19th
5:30 - 6:00 PM - Social time featuring good food and beverages
6:00 - ~7:30 PM - Presentation and Discussion

Location
ILM Professional Services
5221 Viking Drive
Edina, MN 55435

Free on-site parking is available.

This meeting is hosted and sponsored by ILM Professional Services.

CClark Plugin and Device Calendar Save works weird

$
0
0

Hi

I want to save appointments to the device calendar. (No need to get only save).

I use CClark Plugin

Firstly want to use the GCalendar, but there are so many discusson about the Google Calendar and everybody says its impossible to connect to Google Calendar from Xamarin.Forms, and i choosed other solution (but i am very Sad about the GCalendar)

Anyway, lets see the device calendar. I can create calendar, and get the id, but its strange when i want to save:

My code:

 public void MultipleAddOrUpdateAppointments(List<TestItem> testitemsList)
        {
            var items = TestItem.SaveToDeviceCalendar(testitemsList);
            foreach (CalendarEvent item in items)
            {
                CrossCalendars.Current.AddOrUpdateEventAsync(ownCalendar, item);
            }
        }

You can see, i have the full appointments in the items variable. So, I can't get any result. No Exception, No nothing, and in the device calendar i havent got any data.

I need to work, because there are no any support for recurring appointment, so thats why i created that way.

I gave permissions, read write too.

I dont know what is the problem, i create many ways to can save the appointments list to device calendar, but all result is the same.

  • Any idea whats wrong?

  • Or somebody can know an alternative plugin or way to save device calendar from Xamarin.Forms?

  • i would just like to ask quietly if anyone has found any solution for google calendar from xamarin.forms, that would be the best

Video Player inside CollectionView item addition causes video frame shuffle Xamarin Forms

$
0
0

I have a CollectionView that has a VideoPlayer element in its DataTemplate taken from Xamarin Forms sample projects. On iOS, the video player rendered uses AVPlayer to play video.
I also have a button that when pressed, adds more items to the ItemSource of the CollectionView.
If I play the first, say, three items and pause them all on random frame/time, and then press this add more items button, the frozen image frames on these three AVPlayer instances on iPhone get shuffled/switched in some weird order.
In more detail:

If the first item of the CollectionView has some animated cartoon video paused, and the second item has some sports game video paused, and the third item has some forest images video paused, when I press the add more items button, and some new items get added to the ItemSource of the CollectionView, I see the sports game video frame moved to the first item's AVPlayer instance, the forest images video frame moved to second item's AVPlayer instance and the animated cartoon frame is moved to third item's AVPlayer instance.
After these have been 'shuffled', if I unpause the first item, it plays its original video of animated cartoon, and same goes with item two and three. The only problem, as I understand it, is that somewhere in the caching / cell reusing mechanism of CollectionView, the cached frames of AVPlayer are switched in some order when new items are added to the CollectionView.
This problem happens exclusively with AVPlayer. Any other element, does not reproduce this behavior. I have tried with ffimageloading's CahcedImage, simple labels and other elements, but it is only AVPlayer's rendered, paused frame images that get shuffled.
I realize this issue probably has some deep roots that won't be solved on Xamarin Forms level, but just wanted to try my luck here.

My code for the CollectionView is pretty basic:

<CollectionView ItemsSource="{Binding ScrollArticles}" 

                AbsoluteLayout.LayoutBounds="0,0,1,1"
                AbsoluteLayout.LayoutFlags="All"
        RemainingItemsThreshold="5"
                RemainingItemsThresholdReachedCommand="{Binding LoadMoreItems}"
                VerticalOptions="FillAndExpand" 
                HorizontalOptions="FillAndExpand"
                ItemsLayout="VerticalList"
                x:Name="CategoryItemsListView"
                VerticalScrollBarVisibility="Always"
                Scrolled="CategoryItemsListView_OnScrolled"

                >

    <CollectionView.ItemTemplate>
        <DataTemplate>

                <elements:VideoPlayer Margin="0,0,0,15" Source={Binding video_url}>

                </elements:VideoPlayer>

        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>

The same exact code, when having the VideoPlayer element replaced with any other element, say Image, behaves as it should.
Another thing is that the same exact VideoPlayer code does not do this when implemented inside ListView (with CachingStrategy=RecycleElement) instead of CollectionView. But unfortunately, ListView lacks a lot of features such as determining the center most item when scrolling etc.

Xamarin.Forms preview not working for iOS

$
0
0

Hello.

When opening a XAML file in the designer for iOS I get the error "An exception occurred while rendering the control" and, clicking the red exclamation point icon, "Could not load the file 'Xamarin.Forms.Platform.iOS'".

It loads and displays fine for Android.

The XAML page is the "AboutPage.xaml" that comes with the project templates.

I am able to compile, run, and deploy the iOS project both in the simulator and on my iPhone.

I'm using VS 2019 Community (16.6.0), Xcode 11.5, and Xamarin.Forms 4.6.0.800 (according to NuGet pkg manager).

I tried this and it did not resolve the issue: https://forums.xamarin.com/discussion/comment/410256#Comment_410256

Any help is greatly appreciated.

Mike


How to get index and id from SfRadioButton?

$
0
0

How to get index and id from SfRadioButton? I use sfradiobutton and need its index / id

Image height not auto adjust

$
0
0

Hello, I have an Image wich is located inside a Stacklayout (no height set). I would like to size the image to 100% width of the Stacklayout and the height dynamically.
I've tried all Aspect possibilities and it is not working. With option "AspectFill" the Image is cut off.


Any suggestions?
Thanks.

Dirk

Adaptive icon background not setting correctly

$
0
0

I am trying to get adaptive icons to work for my android project in Xamarin.Forms. I created a PNG with no background using Android Asset Studio and added it to my project within the respective DPI folders, renaming it launcher_foreground. I set the background color in the colors.xml file. But, when I launch the app in the emulator, the app background defaults to white (not the color I chose). How do I fix this?

In-App Update using Play Core Library

$
0
0

Hey you guys, need help!!

I have an app in Google Play that scan some QR Codes, and these Codes had a pattern, and we have to change it, because the read is very very slow. We will update the QRs and the App, but we have to force an update and keep the correct functionality. I was reading about an "in-app update" on https://developer.android.com/guide/app-bundle/in-app-updates and in there, they say that requires a library called Play Core. There is a Play Core Library for Xamarin? Considering that this site uses Android Studio (Java) for implementations references.

When using xamarin.forms.Pancake causes the app to crash

$
0
0

When I try to navigate to a page with Pancake view, It causes the app to crash with an error

"Attempt to invoke virtual method 'void android.graphics.Bitmap.setHasAlpha(boolean)' on a null object reference'".

Below is the sample text. Note as soon as I remove Pancake view it renders perfectly.

<pancakeview:PancakeView BackgroundColor="{StaticResource WhiteColor}" CornerRadius="6">
                    <Grid RowSpacing="0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Image
                            Grid.Row="0"
                            Aspect="AspectFill"
                            Source="{Binding Image}" />
                        <Label
                            Grid.Row="1"
                            Style="{StaticResource PostTitleStyle}"
                            Text="{Binding SubTitle}" />
                        <Label
                            Grid.Row="2"
                            Style="{StaticResource PostDateStyle}"
                            Text="{Binding Date}" />
                        <Label />
                    </Grid>
                </pancakeview:PancakeView>
            </DataTemplate>
Viewing all 204402 articles
Browse latest View live


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