Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.05k stars 1.37k forks source link

qmui_queryItems 返回值类型错误会导致swift中调用崩溃 #1391

Closed xixisplit closed 1 year ago

xixisplit commented 2 years ago

Bug 表现 问题的具体描述 NSURL (QMUI) 文件中 qmui_queryItems 参数的指定返回值类型为 (NSDictionary<NSString , NSString > *) 但是.30行的 [params setObject:obj.value ?: [NSNull null] forKey:obj.name] 中.obj.value 如果为空.则会赋值 NSNull 会触发swift 中对参数类型的强制校验.引发崩溃. 控制台提示: Could not cast value of type 'NSNull' (0x2076dbeb8) to 'NSString' (0x2076d8e30).

截图 Bug 现场的界面截图,或者 Xcode 控制台的错误信息截图,有问题的代码截图 如何重现 let url = NSURL.init(string: "https://www.baidu.com?key") debugPrint(url?.qmui_queryItems) swift 项目 直接调用以上代码即可

预期的表现 正常情况下,应该是什么表现

其他信息

MoLice commented 2 years ago

感谢指出,下个版本会修复,在此之前请将本地代码改为:

[params setObject:obj.value ?: @"" forKey:obj.name];
BinBear commented 2 years ago

下个版本有发布计划吗

MoLice commented 2 years ago

近期暂无大版本,小版本如果需要的话可以两周内发一个。

MoLice commented 1 year ago

已发布 4.5.0 修复该问题。