Search code examples
c#facebookwindows-phonewindows-phone-8.1facebook-c#-sdk

NavigationService.Navigate neither navigates nor throws any exception


I have a NavigationService.Navigate() call inside,

void MainPage_Loaded(object sender, RoutedEventArgs e)
{        
    if (!IsoStoreSettings.ContainsKey("accesstoken") || !(IsoStoreSettings.ReadKey<DateTime>("tokenexpiry") > DateTime.Now))
    {
      NavigationService.Navigate(new Uri("/signin.xaml", UriKind.Relative));
    }
}

However, this doesn't navigate to signin.xaml. But, the OnNavigatedTo() event is getting called twice. What am I doing wrong? I also added Facebook SDK to the project.

I also have RootFrame.UriMapper = new FacebookUriMapper(); in App.xaml.cs

Update This has something to do with the version of Facebook and Facebook.Client that I used. There are some incompatibilities between latest alpha packages.


Solution

  • The file FacebookUriMapper in the Facebook.Client SDK has a bug. When looking via debugger, it doesn't redirect to the target page, but switches back to the default RedirectUri in Facebook.xml. Clone the repository in your computer, open the WP8 solution, restore required Nuget packages. Now, open FacebookUriMapper.cs file, modify the last else block to return uri. Build and use this as your referenced assembly. NavigationService works absolutely fine after this.