我是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/,代码应该有效。请帮忙。
答案 0 :(得分: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初始化。