I am trying to open an ios app from my xamarin forms ios app. I have referred this thread for this feature, but I am getting error: "Invalid input URL"
message on the output box.
Interface on Main project
public interface IAppHandler
{
Task<bool> LaunchApp(string uri);
}
IOS
[assembly: Dependency(typeof(OpenAppImplementation))]
namespace Projectname.iOS.Renderer
{
public class OpenAppImplementation : IAppHandler
{
public Task<bool> LaunchApp(string uri)
{
try
{
var canOpen = UIApplication.SharedApplication.CanOpenUrl(new NSUrl(uri));
if (!canOpen)
return Task.FromResult(false);
return Task.FromResult(UIApplication.SharedApplication.OpenUrl(new NSUrl(uri)));
}
catch (Exception ex)
{
return Task.FromResult(false);
}
}
}
}
Info.plist: App Bundle Identifier details added here.
In the view
ar appname = "App Bundle Identifier";
var result = await DependencyService.Get<IAppHandler>().LaunchApp(appname);
if (!result)
{
Device.OpenUri(new Uri("Appstore link"));
}
When I am trying to open the app I am getting 2020-09-05 13:41:30.761 ProjectName.iOS[1128:451468] -canOpenURL: failed for URL: "Bundle Identifier" - error: "Invalid input URL"
on the output box. What I am missing in this implementation?
LSApplicationQueriesSchemes
is blank in my project. But on the thread I have referred have Item 0, Item 1 keys. In my case I can't add anything on the left column. #43944783 – Atmospheric