iOS设备上的Dropbox SDK无法使用NSURLErrorDomain登录 [英] iOS Dropbox SDK on Device fails login with NSURLErrorDomain

查看:129
本文介绍了iOS设备上的Dropbox SDK无法使用NSURLErrorDomain登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:将Dropbox SDK设置为使用HTTP而不是HTTPS可以解决iPhone 3G上的此问题。我没有在iPhone 4或iPad上使用SDK,因此我不确定结果。

UPDATE: Setting the Dropbox SDK to use HTTP instead of HTTPS cures this problem on an iPhone 3G. I haven't used the SDK on iPhone 4 or iPad yet so I'm not sure of the result.

在iOS上使用Dropbox SDK产生以下结果:模拟器,我可以使用提供的登录表单类正确链接我的帐户。将构建设置更改为设备,我在DBLoginController.m中通过此方法触发alertView错误

Playing with the Dropbox SDK on iOS yields these results: in simulator, I can properly link my account using the provided login form class. Changing the build setting to device, I get an error alertView triggered by this method in DBLoginController.m

- (void)restClient:(DBRestClient*)client loginFailedWithError:(NSError*)error {
    [self setWorking:NO];
    NSString* message;
    if ([error.domain isEqual:NSURLErrorDomain]) {
        message = @"There was an error connecting to Dropbox.";
    } else {
        //...

显示登录表单如下所示:

The login form is displayed like so, as referenced in the included sample project:

-(void)settingsPressed {
if (![[DBSession sharedSession] isLinked]) {
        DBLoginController* controller = [[DBLoginController new] autorelease];
        controller.delegate = self;
        [controller presentFromController:self];
    } else {
        [[DBSession sharedSession] unlink];
        [[[[UIAlertView alloc] 
           initWithTitle:@"Account Unlinked!" message:@"Your dropbox account has been unlinked" 
           delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]
          autorelease]
         show];
        [self updateButtons];
    }

}

做这个。 Apple文档建议NSURLErrorDomain定义为NSURL加载系统错误。

I'm not sure what to make of this. Apple docs suggest that NSURLErrorDomain is defined as NSURL loading system errors. Can anyone shed light on that?

推荐答案

你应该看到的是 error.code 或更好 [error localizedDescription]

What you should look at is error.code or better [error localizedDescription]

NSURLErrorDomain 庞大的错误域:


NSError用于区分错误代码的域的常量,用作来自不同子系统或源的错误代码的鉴别符

Constants used by NSError to differentiate between "domains" of error codes, serving as a discriminator for error codes that originate from different subsystems or sources

NSURLErrorDomain中的错误可能几乎是任何事情,代理,证书错误...在 NSURLError /foundation/Miscellaneous/Foundation_Constants/Reference/reference.htmlrel =nofollow>苹果文档页

An error in NSURLErrorDomain could be almost anything, connection down, proxy, certificate errors... Search for NSURLError in that apple documentation page.

这篇关于iOS设备上的Dropbox SDK无法使用NSURLErrorDomain登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆