我现在正在写一个Windows Phone应用程序,我需要read_mailbox权限,在我在facebook的开发帐户中这样做了: 1)我去App详细信息部分 2)我单击应用程序中心权限编辑框中的配置应用程序中心权限按钮我设置了read_mailbox,然后单击保存。
但我仍然在我的应用程序中收到异常消息,说我的应用程序需要这些权限,有什么问题?这是我用C#编写的代码片段
try
{
FacebookClient _fb = new FacebookClient(Global.GAccessToken);
var query = "SELECT body, author_id, viewer_id, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id)";
dynamic parameters = new ExpandoObject();
parameters.q = query;
dynamic result = await _fb.GetTaskAsync("fql", parameters);
// TODO with the result
}
catch (FacebookApiException ex)
{
string str = ex.Message;
}
答案 0 :(得分:1)
我使用facebook按钮解决了我的问题
<FacebookControls:LoginButton
x:Name="btnFacebook"
Margin="0,0,272,258"
HorizontalAlignment="Right"
ApplicationId="418614261571757"
SessionStateChanged="OnSessionStateChanged"
UserInfoChanged="OnUserInfoChanged"
Width="174"
Height="66"
RenderTransformOrigin="0.523,1.49"
VerticalAlignment="Bottom"
Permissions="publish_stream,email,user_location,offline_access,read_mailbox"
/>
现在我可以使用异步任务并从我的邮箱中获取邮件: 实施例
private async void FqlAsyncExample()
{
try
{
FacebookClient fb = new FacebookClient(Global.GAccessToken);
var query = "SELECT body, author_id, viewer_id, created_time FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0)";
dynamic parameters = new ExpandoObject();
parameters.q = query;
dynamic result = await fb.GetTaskAsync("fql", parameters);
...