1
votes

Few weeks ago i ask a question in Xamarin Forums about a problem i have with Facebook Schemes with Xamarin Forms, more precisely with iOS. (The question in here : https://forums.xamarin.com/discussion/comment/141207/#Comment_141207). I still except an answer so i decided to ask to StackOverflow too to augment my chances to have an answer.

I try to open an url on the Facebook application if installed and if not to open the web browser. I have that code :

try{
    Device.OpenUri (new Uri("fb://page/page_id"));
}
catch(Exception e){
    System.Diagnostics.Debug.WriteLine (e.Message);
    Device.OpenUri (new Uri("https://www.facebook.com/pages/...."));
}

It worked perfectly on Android, if Facebook is not installed or if the scheme is not correct an ActivityNotFoundException is raised.

But on iOS there isn't any exception raised. I haven't try on Windows Phone yet. Does anyone knows why the iOS platform does not raise an exception ?

Thanks in advance.

1

1 Answers

0
votes

Have you tried this on a real device? This URI is probably not supported on an emulator. If you look at how iOS opens URI it usually just returns false instead of an exception if it can't open an URI which is probably why you don't see an exception. You should see the same thing if you try and make a phone call from the emulator.