Post

Replies

Boosts

Views

Activity

Reply to Crash in iOS18
I had similar issue with iOS18.(issue exists in below code) func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsPageCell", for: indexPath) as? FTShelfTagsPageCell else { return UICollectionViewCell() } cell.selectionBadge?.isHidden = viewState == .none ? true : false if indexPath.section == 0 { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsBooksCell", for: indexPath) as? FTShelfTagsBooksCell else { return UICollectionViewCell() } return cell } else if indexPath.section == 1 { let item = pages[indexPath.row] cell.updateTagsItemCellContent(tagsItem: item, isRegular: self.traitCollection.isRegular) } cell.isSelected = true return cell } It is dequeuing 2 cells though I return single cell. After simplification like below, issue got fixed. (only 1 cell ll be dequeued at a time.) func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if indexPath.section == 0 { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsBooksCell", for: indexPath) as? FTShelfTagsBooksCell else { return UICollectionViewCell() } return cell } else { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsPageCell", for: indexPath) as? FTShelfTagsPageCell else { return UICollectionViewCell() } let item = pages[indexPath.row] cell.selectionBadge?.isHidden = viewState == .none ? true : false cell.updateTagsItemCellContent(tagsItem: item, isRegular: self.traitCollection.isRegular) cell.isSelected = true return cell } }
Topic: UI Frameworks SubTopic: UIKit
Jul ’24
Reply to SWIFT TASK CONTINUATION MISUSE - leaked its continuation!
func saveAndCloseWithCompletionHandler(_ onCompletion :((Bool) -> Void)?) { self.prepareForClosing(); self.saveDocument { (saveSuccess) in if(saveSuccess) { self.closeDocument(completionHandler: { (_) in onCompletion?(saveSuccess); }); } else { onCompletion?(saveSuccess); } } } func prepareForClosing() { #if !NS2_SIRI_APP //save local meta data cache self.localCacheWrapper?.saveMetadataCache(); self.deleteUnusedFileItems(); #endif } func saveDocument(completionHandler : ((Bool) -> Void)?) { if(self.openPurpose == .read) { completionHandler?(true); return; } if(self.hasAnyUnsavedChanges) { (self.delegate as? FTNoteshelfDocumentDelegate)?.documentWillStartSaving(self); } #if !NS2_SIRI_APP self.recognitionCache?.saveRecognitionInfoToDisk(forcibly: true); if(self.hasAnyUnsavedChanges) { if let cache = self.recognitionCache, let cachePlist = cache.recognitionCachePlist() { let mutableDict = NSMutableDictionary.init(dictionary: cachePlist.contentDictionary); self.recognitionInfoPlist()?.updateContent(mutableDict); } if let cache = self.recognitionCache, let cachePlist = cache.visionRecognitionCachePlist() { let mutableDict = NSMutableDictionary.init(dictionary: cachePlist.contentDictionary); self.visionRecognitionInfoPlist()?.updateContent(mutableDict); } //This was added in version 6.2, when we removed the bounding rect from the Segment level storage. updateDocumentVersionToLatest() } #endif super.save { (success) in if(success) { self.previousFileModeificationDate = self.fileModificationDate; let pages = self.pages(); for eachPage in pages { eachPage.isDirty = false; } } completionHandler?(success); } } func closeDocument(completionHandler: ((Bool) -> Void)?) { #if !NS2_SIRI_APP self.recognitionCache?.saveRecognitionInfoToDisk(forcibly: true) #endif super.close { (success) in self.removeObservers(); completionHandler?(success); } } // in above function, super is --> UIDocument
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to "an error occurred trying to capture leaks data"
I am facing the same issue in memory debug of Xcode and even via instruments macOS Version 15.5 (Build 24F5068b) Xcode 16.3 (23785) (Build 16E140)
Replies
Boosts
Views
Activity
May ’25
Reply to Possible to start a live activity on watchOS 11?
Similar question - Is it possible to show my watch recording activity in watch widget that shows recording time and at the same time AND from widget itself, I should be able to start and stop my recording.
Replies
Boosts
Views
Activity
Aug ’24
Reply to Crash in iOS18
I had similar issue with iOS18.(issue exists in below code) func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsPageCell", for: indexPath) as? FTShelfTagsPageCell else { return UICollectionViewCell() } cell.selectionBadge?.isHidden = viewState == .none ? true : false if indexPath.section == 0 { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsBooksCell", for: indexPath) as? FTShelfTagsBooksCell else { return UICollectionViewCell() } return cell } else if indexPath.section == 1 { let item = pages[indexPath.row] cell.updateTagsItemCellContent(tagsItem: item, isRegular: self.traitCollection.isRegular) } cell.isSelected = true return cell } It is dequeuing 2 cells though I return single cell. After simplification like below, issue got fixed. (only 1 cell ll be dequeued at a time.) func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if indexPath.section == 0 { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsBooksCell", for: indexPath) as? FTShelfTagsBooksCell else { return UICollectionViewCell() } return cell } else { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FTShelfTagsPageCell", for: indexPath) as? FTShelfTagsPageCell else { return UICollectionViewCell() } let item = pages[indexPath.row] cell.selectionBadge?.isHidden = viewState == .none ? true : false cell.updateTagsItemCellContent(tagsItem: item, isRegular: self.traitCollection.isRegular) cell.isSelected = true return cell } }
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Jul ’24
Reply to SWIFT TASK CONTINUATION MISUSE - leaked its continuation!
func saveAndCloseWithCompletionHandler(_ onCompletion :((Bool) -> Void)?) { self.prepareForClosing(); self.saveDocument { (saveSuccess) in if(saveSuccess) { self.closeDocument(completionHandler: { (_) in onCompletion?(saveSuccess); }); } else { onCompletion?(saveSuccess); } } } func prepareForClosing() { #if !NS2_SIRI_APP //save local meta data cache self.localCacheWrapper?.saveMetadataCache(); self.deleteUnusedFileItems(); #endif } func saveDocument(completionHandler : ((Bool) -> Void)?) { if(self.openPurpose == .read) { completionHandler?(true); return; } if(self.hasAnyUnsavedChanges) { (self.delegate as? FTNoteshelfDocumentDelegate)?.documentWillStartSaving(self); } #if !NS2_SIRI_APP self.recognitionCache?.saveRecognitionInfoToDisk(forcibly: true); if(self.hasAnyUnsavedChanges) { if let cache = self.recognitionCache, let cachePlist = cache.recognitionCachePlist() { let mutableDict = NSMutableDictionary.init(dictionary: cachePlist.contentDictionary); self.recognitionInfoPlist()?.updateContent(mutableDict); } if let cache = self.recognitionCache, let cachePlist = cache.visionRecognitionCachePlist() { let mutableDict = NSMutableDictionary.init(dictionary: cachePlist.contentDictionary); self.visionRecognitionInfoPlist()?.updateContent(mutableDict); } //This was added in version 6.2, when we removed the bounding rect from the Segment level storage. updateDocumentVersionToLatest() } #endif super.save { (success) in if(success) { self.previousFileModeificationDate = self.fileModificationDate; let pages = self.pages(); for eachPage in pages { eachPage.isDirty = false; } } completionHandler?(success); } } func closeDocument(completionHandler: ((Bool) -> Void)?) { #if !NS2_SIRI_APP self.recognitionCache?.saveRecognitionInfoToDisk(forcibly: true) #endif super.close { (success) in self.removeObservers(); completionHandler?(success); } } // in above function, super is --> UIDocument
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23