Question

I'm new to the Facebook SDK

While Using the Single Sign On Facebook SDK for Windows Phone 8. I added the <Protocol Name="msft-[AppId]" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" /> in the WMAppManifest.xml file. But When I run the debug the app, it shows an exception the

"No XAML was found at the location '/Protocol'"

What shall I do to resolve it

Was it helpful?

Solution 2

Add Protocol under extensions like this:

<Extensions> 
  <Protocol Name="msft-[AppId]" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" /> 
</Extensions> 

check this sample

related blog link is given at last, please check that also.

OTHER TIPS

First of all i don't think the Protocol Name attribute is correct. Based on MSDN about the Protocol Name: The prefix in your custom URI scheme. A string between 2 and 39 characters in length that contains numbers, lowercase letters, periods ('.'), or hyphens ('-'). Do not include the colon (':') or anything else that will follow the prefix in the URI.

Apart from that i beleive you are trying to navigate in a uri that doesn't exist. What i suggest is break in the constructor of your custom uri mapper. You should have a class similar to this

public class CustomUriMapper: UriMapperBase
{
    public override Uri MapUri(Uri uri)
    {
        // Break into this point to detect the incoming uri and be sure
        // to return a valid xaml page if tempuri contains your protocol name
        string tempUri = uri.ToString();
        string mappedUri = string.Empty;
        // Search for a specific deep link URI keyword
        if (tempUri.Contains("msftappid"))
        {
            // Launch to the mainpage xaml.
            return new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
        }
        // Otherwise perform normal launch.
        Debug.WriteLine("Normal launch detection");
        return uri;
    }
}

Break into constructor to detect the incoming uri and be sure to return a valid xaml page if tempuri contains your protocol name. In your example msft-[AppId] should be msftappid.

Just go to App.xaml.cs and into InitializePhoneApplication() insert this code:

RootFrame.UriMapper = new CallbackUriMapper();

You need this to initialize the callback class. (CallbackUriMapper() is an example. Just put the name you applied to that class).

firstly, FB beta app is invoking your app properly.. and your App.xaml.cs dont know where to redirect the control... hence the error.

Sol:

i. add this line

RootFrame.UriMapper = new ContosoCallbackUriMapper(); 

in side your App.xaml.cs file in method InitializePhoneApplication().

ii. Import this class file ContosoCallbackUriMapper.cs from the sample example downloaded from MSDN page.. LINK HERE

And add it to you project level.

it should work fine..

if read the code... step 1 tells to use this class for any URI mapping,, n step 2 tells that if State is authenticated, redirect the user to Main.xaml...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top