简体   繁体   English

编译器无法在合理的时间内对这个表达式进行类型检查。 尝试将表达式分解为不同的子表达式

[英]The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

I am new in Ios programming and the below expressing is giving an error: 我是Ios编程的新手,以下表示给出了错误:

let combine = date.enumerated().map {index, date in
 return (date,self.arrFriendId[index],self.arrFriendName[index],self.arrFriendImage[index],self.arrMsgType[index],self.arrMessage[index], self.arrLastMsgTime[index], self.arrNotifyStatus[index])}

please help me to solve this. 请帮助我解决这个问题。 thanks in advance 提前致谢

This error generally occurs when a single expression is doing a lot of things. 当单个表达式执行大量操作时,通常会发生此错误。 So compiler tells you to break it to sub-expressions. 因此,编译器告诉您将其分解为子表达式。

Assuming you want the output combine of type Array<Any> , You can do it like this: 假设您想要Array<Any>类型的输出combine ,可以这样进行:

let combine = date.enumerated().map { index, date -> Any in
    let id = self.arrFriendId[index]
    let name = self.arrFriendName[index]
    let image = self.arrFriendImage[index]
    let messageType = self.arrMsgType[index]
    let message = self.arrMessage[index]
    let messageTime = self.arrLastMsgTime[index]
    let status = self.arrNotifyStatus[index]
    return (date, id, name, image, messageType, message, messageTime, status)
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Swift 编译器无法在合理的时间内对该表达式进行类型检查; 尝试将表达式分解为不同的子表达式 - Swift The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions 表达太复杂,无法在合理的时间内解决; 考虑将表达式分解为不同的子表达式? - expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions? 表达过于复杂,无法在合理的时间内解决。 考虑将表达式分解为不同的子表达式 - Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions Swift-表情过于复杂,无法在合理的时间内解决; 考虑将表达式分解为不同的子表达式 - Swift - Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions 声明数组时出现编译器错误:编译器无法进行类型检查……不同的子表达式 - Compiler error while declaring an array: compiler is unable to type-check … distinct sub-expressions 编译器无法在合理的时间内对该表达式进行类型检查 SWIFTUI? - The compiler is unable to type-check this expression in reasonable time SWIFTUI? 编译器无法在合理时间内对该表达式进行类型检查 --&gt; Xcode swift - The compiler is unable to type-check this expression in reasonable time --> Xcode swift 我的问题:编译器无法在合理的时间内对该表达式进行类型检查; - My problem: The compiler is unable to type-check this expression in reasonable time; 编译器无法在 SwiftUI 中的合理时间内对该表达式进行类型检查? - The compiler is unable to type-check this expression in a reasonable time in SwiftUI? SwiftUI:! [Array] 编译器无法在合理的时间内对该表达式进行类型检查 - SwiftUI:! [Array] the compiler is unable to type-check this expression in reasonable time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM