Post

Replies

Boosts

Views

Activity

UIContextMenuConfiguration causes retain cycle
Hi dear Apple developers! I need help to solve memory leak issue with CollectionView and UIContextMenuConfiguration I'm struggling few weeks with. I have a fairly simple setup - Main ViewController and pushed ViewControllers with CollectionView within NavigationController. All is Ok with memory during navigation back and forth until I use CollectionViewCell's Context Menu (calling contextMenuConfigurationForItemAt method and returning even blank ContextMenuConfiguration instance). So when I pop ViewController, objects are being kept in memory after that. I think called UIContextMenuConfiguration instance causes retain cycle. I just cannot find similar case or way to solve this. One thing. I see deinit happens in popped ViewController but not with its CollectionView Cell. Please help!
5
0
937
Mar ’21
UIDragItem causes memory leak when Context Menu has been initialised
Hi! I have a CollectionView with Drag and Drop and Context Menu functionality. There's a memory leak caused by returned [UIDragItem] array in ItemsForBeginning method when I initialise cell's context menu. Objects are being kept in memory when I pop to rootViewController. All is OK though when drag session was happened. I've ended up commenting out everything, keeping blank UIDragItem and problem is still there:     func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) - [UIDragItem] {         let dragItem = UIDragItem(itemProvider: NSItemProvider(object: "" as NSString))         return [dragItem]     } Does anybody experience this? Looks like it's a UIKit bug... Please help!
2
0
1.1k
Mar ’21