1

我是 C# 和 Windows Phone 7 开发的新手,在尝试使用Dropnet api 时出现错误:

using DropNet;

namespace Hello
{

public partial class App : Application
{
    public PhoneApplicationFrame RootFrame { get; private set; }

    public static DropNetClient DropNetClient { get; set; }

    public App()
    {

        InitializeComponent();

        InitializePhoneApplication();

        DropNetClient = new DropNetClient("api key", "secret");
//I've correct app key and secret inserted here

        DropNetClient.GetTokenAsync((userLogin) =>
        {
            //Dont really need to do anything with userLogin, 
//DropNet takes care of it for now
        },
    (error) =>
    {
        //Handle error
    });

        var url = DropNetClient.BuildAuthorizeUrl();
//getting error here


    }
}

我得到的错误是

ArgumentNullException was unhandled
Value cannot be null
Parameter name: userLogin

根据http://dkdevelopment.net/what-im-doing/dropnet/代码应该可以工作。请帮忙。

4

1 回答 1

0

从您提供的链接中引用:

_client = new DropNetClient("API KEY", "API SECRET", "USER TOKEN", "USER SECRET");
// OR
_client = new DropNetClient("API KEY", "API SECRET");
_client.UserLogin = new UserLogin { Token = "USER TOKEN", Secret = "USER SECRET" };

您缺少 UserLogin 初始化。

于 2012-04-16T15:30:35.987 回答