deinit не вызывается по-быстрому
У меня есть следующий код, который устанавливает объект nil
, но deinit
не был назван. я имею deinit
чье тело print("deinit")
, Но это никогда не называлось.
let dispatchGroup = dispatch_group_create()
retVal = NSMutableArray()
for index in 0..<users.count {
let dictionary:NSDictionary = users.objectAtIndex(index) as! NSDictionary
let userId = dictionary.getValueAsString("_id")
let currentUserId = AppDelegate.sharedDelegate().userId!
if userId != currentUserId {
dispatch_group_enter(dispatchGroup)
var userModelHandler:UserModelHandler? = UserModelHandler()
userModelHandler?.fetchUser(userId: userId!) { groupUserInfo in
if let group = group {
groupUserInfo.group = [group]
}
retVal?.addObject(groupUserInfo)
dispatch_group_leave(dispatchGroup)
}
userModelHandler = nil
}
}
dispatch_group_notify(dispatchGroup, dispatch_get_main_queue()) {
UserModelHandler.downloadUsersProfilePicture(retVal!, completionHandler:completionHandler)
}
func fetchUser(userId id:NSString, block:CompletionBlock?) {
self.block = block
let appDelegate = AppDelegate.sharedDelegate()
let userId = id as String
let token = appDelegate.token as! String
let userHanlder = UserHandler()
userHanlder.fetchUser(userId: userId, token: token, delegate: operationDelegate!)
}