I am not asking for help fixing a crash. I did that by commenting out one line of code where I was asking SwiftData to sort ModelA results on a title string from an associated ModelB object. ModeB has a one to many association to ModelA and must exist before any ModelA objects are created BUT CloudKit requires that you specify the relationships between these two models as Optional. Therefore when I tried to sort ModelA results by a Title in ModelB I needed to declare the property as a force unwrapped title of ModelB in the SortDescriptor. It would be ludicrous to try to show the actual code so that you can follow everything.
Suffice it to say that this SortDescriptor was accepted by the compiler, and gave me exactly what I wanted when I ran the App either in a Simulator or on a device that downloaded the app from Xcode. BUT when the app was uploaded to the App Store and then downloaded from TestFlight the App would immediately crash with no useful error pointing to the problem.
Bottom line is I found the issue after months of digging and now I just want to restore the capability I had before I had to comment out that line of code. As I said I tried using a computed property in ModelA (rather than store the title from ModelB it would fetch it when needed) and used that computed property as the sort descriptor but although this is also accepted by the compiler this fails as well.
I suppose I can do a sort on the array AFTER it is fetched by SwiftData but that seems less efficient. Anyway wondering if anyone else has run into this limitation and has found a better workaround.