Dropbox SDK 401错误 [英] Dropbox SDK 401 Error
问题描述
我正在使用Dropbox SDK,我已将其设置为应用程序只能访问/ Apps / MyAPP文件夹。我正在测试它并在线删除文件夹。现在,当我在应用程序而不是要求重新链接Dropbox时,它给我一个401错误。我不知道它为什么不显示视图。它在我删除文件夹之前工作(在线取消链接应用程序)。提前谢谢。
I am using the Dropbox SDK and I have it set up so the app can only access the /Apps/MyAPP folder. I was testing it out and deleted the folder online. Now when I'm in the app instead of asking to relink dropbox it gives me a 401 error. I don't know why it doesn't display the view. It was working before I deleted the folder(unlinking the app online). Thank you in advance.
PageFlipper [66893:c07] [警告] DropboxSDK:向
/ 1 /元数据发出错误请求/ sandbox - 令牌无效。 2012-08-23 03:10:12.920
PageFlipper [66893:c07]加载元数据时出错:错误
Domain = dropbox.com Code = 401操作无法完成。
(dropbox.com错误401.)UserInfo = 0x23263fe0 {path = /,error = Token is
invalid。}
PageFlipper[66893:c07] [WARNING] DropboxSDK: error making request to /1/metadata/sandbox - Token is invalid. 2012-08-23 03:10:12.920 PageFlipper[66893:c07] Error loading metadata: Error Domain=dropbox.com Code=401 "The operation couldn’t be completed. (dropbox.com error 401.)" UserInfo=0x23263fe0 {path=/, error=Token is invalid.}
-(IBAction)addDropBox:(id)sender{
if (![[DBSession sharedSession] isLinked]) {
[[DBSession sharedSession] linkFromController:[self parentViewController]];
}
[[self restClient] loadMetadata:@"/"];
restClient = nil;
};
推荐答案
我遇到了同样的问题。在我的情况下,问题是我确实在用户连接之前设置了restClient 。在这种情况下,未设置userId并且令牌无效。
I had the same problem. In my case the problem was that I did set the restClient before the user was connected. In this case the userId is not set and the token is invalid.
我的restClient getter现在看起来像这样:
My getter for restClient now looks like this:
- (DBRestClient *)restClient
{
if (_restClient == nil) {
if ( [[DBSession sharedSession].userIds count] ) {
_restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
_restClient.delegate = self;
}
}
return _restClient;
}
这篇关于Dropbox SDK 401错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!