iOS Dropbox 数据存储 API:WebKit 异常 + 不受支持 URL
iOS Dropbox Datastore API: WebKit Exception + Unsupported URL
(注意,这似乎是 related to this question,但与 Dropbox SDK 的风格不同。)
在 iOS 上使用最新版本的 Dropbox Datastore API,我在执行这些步骤后遇到异常:
- 成功将我的应用程序连接到 Dropbox
- 断开我的应用与 Dropbox 的连接。
- 将应用程序重新连接到同一个或另一个 Dropbox 帐户。
然后会发生这种情况:
Xcode 中的控制台显示:
*** WebKit discarded an uncaught exception in the webView:
decidePolicyForNavigationAction:request:frame:decisionListener:
delegate: <NSInvalidArgumentException> -[PilotPro.SettingsTableViewController
dropboxWasLinked:]: unrecognized selector sent to instance 0x7fc489cb94d0
然后是这个:
[WARNING] DropboxSDK: error loading DBConnectController - Error
Domain=NSURLErrorDomain Code=-1002 "unsupported URL"
UserInfo=0x7fc48c11bc50 {NSUnderlyingError=0x7fc48c4418c0 "unsupported URL",
NSErrorFailingURLStringKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSErrorFailingURLKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSLocalizedDescription=unsupported URL}
我怀疑我没有采取足够的措施来断开 Dropbox 与我的帐户的连接,因此它与 Dropbox 会话有某种冲突。这是我正在做的断开连接的操作:
//===::: Disable Dropbox :::===
DBAccountManager.sharedManager().linkedAccount.unlink()
// Shutdown and stop listening for changes to the datastores
DBDatastoreManager.sharedManager().shutDown()
DBDatastoreManager.sharedManager().removeObserver(self)
//Migrate back to local datastores
DBDatastoreManager.setSharedManager(DBDatastoreManager.localManagerForAccountManager(DBAccountManager.sharedManager()))
有什么想法吗?提前致谢。
原来 Xcode 给出的错误在这种情况下有点转移注意力。我在 Dropbox 完成身份验证后触发了一个 NSNotification
,在这样做时我使用了这个:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "dropboxWasLinked:", name: "dropboxLinked", object: nil)
...但是我的 dropboxWasLinked
方法没有设置为接收任何参数:
func dropboxWasLinked(){ ... }
所以 Xcode 触发了一个异常,该异常扰乱了身份验证并使其他事情看起来是原因,而实际上我需要做的就是从我的 [= 中删除 :
15=] 在 NSNotification
侦听器中。
啊,编程的乐趣。 :)
(注意,这似乎是 related to this question,但与 Dropbox SDK 的风格不同。)
在 iOS 上使用最新版本的 Dropbox Datastore API,我在执行这些步骤后遇到异常:
- 成功将我的应用程序连接到 Dropbox
- 断开我的应用与 Dropbox 的连接。
- 将应用程序重新连接到同一个或另一个 Dropbox 帐户。
然后会发生这种情况:
Xcode 中的控制台显示:
*** WebKit discarded an uncaught exception in the webView:
decidePolicyForNavigationAction:request:frame:decisionListener:
delegate: <NSInvalidArgumentException> -[PilotPro.SettingsTableViewController
dropboxWasLinked:]: unrecognized selector sent to instance 0x7fc489cb94d0
然后是这个:
[WARNING] DropboxSDK: error loading DBConnectController - Error
Domain=NSURLErrorDomain Code=-1002 "unsupported URL"
UserInfo=0x7fc48c11bc50 {NSUnderlyingError=0x7fc48c4418c0 "unsupported URL",
NSErrorFailingURLStringKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSErrorFailingURLKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSLocalizedDescription=unsupported URL}
我怀疑我没有采取足够的措施来断开 Dropbox 与我的帐户的连接,因此它与 Dropbox 会话有某种冲突。这是我正在做的断开连接的操作:
//===::: Disable Dropbox :::===
DBAccountManager.sharedManager().linkedAccount.unlink()
// Shutdown and stop listening for changes to the datastores
DBDatastoreManager.sharedManager().shutDown()
DBDatastoreManager.sharedManager().removeObserver(self)
//Migrate back to local datastores
DBDatastoreManager.setSharedManager(DBDatastoreManager.localManagerForAccountManager(DBAccountManager.sharedManager()))
有什么想法吗?提前致谢。
原来 Xcode 给出的错误在这种情况下有点转移注意力。我在 Dropbox 完成身份验证后触发了一个 NSNotification
,在这样做时我使用了这个:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "dropboxWasLinked:", name: "dropboxLinked", object: nil)
...但是我的 dropboxWasLinked
方法没有设置为接收任何参数:
func dropboxWasLinked(){ ... }
所以 Xcode 触发了一个异常,该异常扰乱了身份验证并使其他事情看起来是原因,而实际上我需要做的就是从我的 [= 中删除 :
15=] 在 NSNotification
侦听器中。
啊,编程的乐趣。 :)