V
V
Vladimir Vornicescu2018-09-04 17:27:47
iOS
Vladimir Vornicescu, 2018-09-04 17:27:47

Xamarin widgets for iOS8, passing parameters to app possible?

Making a widget for the application, I found that the parameters in ios 8 are not transferred, if the system version is higher, then everything is ok.
I pass parameters like this:

ExtensionContext?.OpenUrl("MyApp://?param=value", (bool success) => {
    if (!success) InfoLabel.Text = "Не удаётся открыть приложение!"; 
  } );

... in the application I catch these parameters like this, in AppDelegate.cs:
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
  {
    string[]
        UriParams = url.RelativeString.Split('?'),
        ParamsVal = UriParams?.Length > 1 ? UriParams[1].Split('=') : null;

    Instance.WidgetAction = ParamsVal?.Length > 1
                ? ParamsVal[1]
                : string.Empty;
  } ;

... and here ios8 for some reason the parameters do not arrive.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Vornicescu, 2018-09-05
@Vornic

I'm answering myself, in case it's useful to someone.
It turns out that there are two OpenUrl methods in the AppDelegate, I chose unsuccessfully
instead of
In this case, the parameters are passed correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question