我有这个奇怪的错误,并且没有任何想法来解决它。
guard let theDialogObjects = dialogObjects as! [QBChatDialog]
来自'[QBChatDialog]?'到'[QBChatDialog]'才打开 自选项目;你的意思是用'!'吗?
- (void)allDialogsWithPageLimit:(NSUInteger)limit
extendedRequest:(NSDictionary *)extendedRequest
iterationBlock:(void(^)(QBResponse *response, NSArray *dialogObjects, NSSet *dialogsUsersIDs, BOOL *stop))iterationBlock
completion:(void(^)(QBResponse *response))completion {
这就是我在Swift中使用它的方式:
QMServicesManager.instance().chatService.allDialogsWithPageLimit(UInt.max, extendedRequest: ["type":String(QBChatDialogType.Private.rawValue)], iterationBlock: { (response, dialogObjects, userIDs, stop) in
guard let theDialogObjects = dialogObjects as! [QBChatDialog]{
return
}
答案 0 :(得分:3)
从错误消息中您不是要尝试更改类型,只需检查值是否为零,所以您的检查应该是:
guard let theDialogObjects = dialogObjects else ...