ios - Swift 4 搜索栏中的搜索过滤器问题

标签 ios swift nsarray nsdictionary swift4

let strArray :NSArray = self.filteredArray?.object(at: indexPath.row) as! NSArray

此行中显示的错误是:

Could not cast value of type '__NSDictionaryM' (0x1b5b8a800) to 'NSArray' (0x1b5b89950).

我怎样才能改变这个?

最佳答案

像这样尝试。

let strArray : NSDictionary = self.filteredArray?.object(at: indexPath.row) as! NSDictionary;

此错误显示“无法将实际类型 NSDictionary 转换为预期类型 NSArray

关于ios - Swift 4 搜索栏中的搜索过滤器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48542915/

相关文章:

ios - 如何获取iOS字体大小并将其设置为应用程序的所有标签?

ios - 如何通过 UITabBarController 将 indexPathForSelectedRow 传递到 UITabView?

ios - 基于变量显示 plist

ios - 为什么(复制,非原子的)NSMutableArray 属性创建 NSArrays?

ios - tabBarController didSelect 没有被调用

ios - 如何使用 WKWebview 检查 phonegap 应用程序

ios - FTP目录名称,其中空格无法在iOS中以编程方式访问

ios - "No Visible Interface For NSFileManager", iOS

ios - 如何在 Swift 中的数组中的特定索引处收集和传递数据?

iphone - 将对象序列化为JSON