Dropbox 选择器在 iOS 中崩溃

Dropbox chooser crashing in iOS

我已经在 iOS 应用程序中集成了保管箱选择器。它一直工作到最近。现在它开始崩溃了。 Dropbox SDK 有什么变化吗?

我可以在选择器和 select 文件中访问保管箱文件视图。但是当它 returns 到 appdelegate 时,它​​崩溃了。

URL 我得到的回复: db-appkey://1/chooser?files=%7B%22link%22%3A%22https%3A%5C%2F%5C%2Fdl.dropboxusercontent.com%5C%2F1%5C%2Fview%5C%2Frsoof482pcg9d1m%5C %2FGet%2520Started%2520with%2520Dropbox.pdf%22%2C%22bytes%22%3A692088%2C%22name%22%3A%22Get%20Started%20with%20Dropbox.pdf%22%2C%22is_dir%22%3Afalse%2C%22icon%22%3A%22https%3A%5C%2F%5C%2Fwww.dropbox.com%5C%2Fstatic%5C%2Fimages%5C%2Ficons64%5C%2Fpage_white_acrobat.png %22%2C%22isDir%22%3Afalse%2C%22thumbnails%22%3A%7B%7D%7D

appdelegate.m

中的代码
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url sourceApplication:(NSString *)source annotation:(id)annotation
{
    if ([[DBChooser defaultChooser] handleOpenURL:url]) {
        // This was a Chooser response and handleOpenURL automatically ran the
        // completion block
        return YES;
    }
    return NO;
}

在第 [[DBChooser defaultChooser] handleOpenURL:url] 行崩溃并出现以下错误:

2016-02-11 15:57:40.413 Backflipt[985:420495] -[__NSCFConstantString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x37768968

检查 Xcode 异常断点处的附加屏幕截图

URL 响应最新的保管箱选择器(版本:4.2.4): db-8343b03llcys1pw://1/chooser?files={"link":"https://dl.dropboxusercontent.com/1/view/rsoof482pcg9d1m/Get%20Started%20with%20Dropbox.pdf","bytes":692088,"name":"Get Started with Dropbox.pdf","is_dir":false,"icon":"https://www.dropbox.com/static/images/icons64/page_white_acrobat.png","isDir":false,"thumbnails":{}}

URL 使用保管箱选择器的响应(版本:3.9): db-8343b03llcys1pw://1/chooser?files=[{"is_dir":false,"thumbnails":{},"isDir":false,"link":"https://dl.dropboxusercontent.com/1/view/kdehqo4khfi0ifo/Getting%20Started.pdf","bytes":249159,"name":"Getting Started.pdf","icon":"https://www.dropbox.com/static/images/icons64/page_white_acrobat.png"}]

为什么最新的保管箱版本返回单个文件字典而不是文件字典数组,这会导致解析逻辑崩溃。

快速解决这个问题的方法是什么?编写我们自己的解析逻辑?

2016 年 2 月 10 日:Dropbox 意识到并正在解决这个问题。

2016 年 2 月 11 日:官方 Dropbox iOS 应用程序的 4.2.5 版现在应该已修复此问题。