I have an 8th generation iPad, now updated with iPadOS 16.2 (20C65) and I have an issue that I also saw on earlier 16.* betas.
Task is not executing at all.
This is so frustrating because I have adopted async/await in my app, I support iOS 15+, everything was working fine but now that stuff inside Task { } is not executed my app seems to be broken. (Note: my main device is an iPhone 11, still on iOS 16.0, and it works fine there.)
It is also frustrating to see no other developers are complaining about this, like it happens only with my app. I have debugged with print statements and breakpoints and I can say for sure that stuff is not executing.
Does anybody have any ideas? Anything else I can try?
FB11866066
All right! I seem to have fixed it with your help!
I had an async function to get image artwork to display in table view cells. Each cell would start a Task to call this function.
The function would first attempt to get the media item's embedded artwork as UIImage by calling MPMediaItemArtwork.image(at:). If this returned nil for some reason, it would then attempt to fetch it via MusicKit using a MusicCatalogResourceRequest. This is why the function is async and why the cell makes the call in a Task.
I split this function in two, one for the embedded artwork (sync) and one for MusicKit artwork (async). The cell calls the first one and only if that fails uses a Task to call the other one.
Now it works and when I pause the app I find no 'com.apple.root.user-initiated-qos.cooperative' threads.
I guess the takeaway is that that API is not thread safe but maybe you can provide some other insight given the above backtrace? Thank you!!