Post

Replies

Boosts

Views

Activity

Watch OS11 My recording play gets paused after a while
Watch OS11 My recording play gets paused when watch I turned down. It was not happening in previous versions. In my app I recorded my recording. And When I play it in my app, it was playing good in debug mode(when Xcode is connected) could not debug. Otherwise, it was automatically paused(when my wrist is down or inactivity time is elapsed) I want it to be continued.
1
0
371
Sep ’24
SWIFT TASK CONTINUATION MISUSE - leaked its continuation!
SWIFT TASK CONTINUATION MISUSE: saveAndClose() leaked its continuation! Inside for loop, after executing few items, at one of the item, in save and close function, it is blocked, and says above error, and not moving to next item, so not able to return result. What could be wrong here, and is there any way to optimize any of these snippets? private func processTags(reqItems: [FTShelfItemProtocol], selectedTags: [String]) async throws -> FTShelfTagsResult { let items: [FTDocumentItemProtocol] = reqItems.filter({ ($0.URL.downloadStatus() == .downloaded) }).compactMap({ $0 as? FTDocumentItemProtocol }) var totalTagItems: [FTShelfTagsItem] = [FTShelfTagsItem]() for case let item in items where item.documentUUID != nil { guard let docUUID = item.documentUUID else { continue }//, item.URL.downloadStatus() == .downloaded else { continue } let destinationURL = FTDocumentCache.shared.cachedLocation(for: docUUID) print(destinationURL.path) // move to post processing phace do { let document = await FTNoteshelfDocument(fileURL: destinationURL) let isOpen = try await document.openDocument(purpose: FTDocumentOpenPurpose.read) if isOpen { let tags = await document.documentTags() let considerForResult = selectedTags.allSatisfy(tags.contains(_:)) if considerForResult && !tags.isEmpty { var tagsBook = FTShelfTagsItem(shelfItem: item, type: .book) tagsBook.tags = tags totalTagItems.append(tagsBook) } } let tagsPage = await document.fetchSearchTagsPages(shelfItem: item, selectedTags: selectedTags) totalTagItems.append(contentsOf: tagsPage) _ = await document.saveAndClose() } catch { cacheLog(.error, error, destinationURL.lastPathComponent) } } cacheLog(.success, totalTagItems.count) let result = FTShelfTagsResult(tagsItems: totalTagItems) return result } func saveAndClose() async -> Bool { return await withCheckedContinuation({ continuation in self.saveAndCloseWithCompletionHandler { isSuccess in continuation.resume(returning: isSuccess) } }) }
2
0
3.0k
Jun ’23