我完全按照例子说明:
protected async override void OnStart ()
{
base.OnStart ();
AppKeyPair appKeys = new AppKeyPair(AppKey, AppSecret);
AndroidAuthSession session = new AndroidAuthSession(appKeys);
dropboxApi = new DropboxAPI (session);
(DropboxApi.Session as AndroidAuthSession).StartOAuth2Authentication (this);
}
但是我收到了错误:
Error CS0120: An object reference is required for the non-static field, method, or property 'Dropbox.CoreApi.Android.DropboxApi.Session.get' (CS0120)
在以下行中:
(DropboxApi.Session as AndroidAuthSession).StartOAuth2Authentication (this);
答案 0 :(得分:1)
这部分:
(DropboxApi.Session as AndroidAuthSession)
应该是:
(dropboxApi.Session as AndroidAuthSession)
注意大写字母D引用类而不是实例。