iCloud Sync Not Working on Physical Device

I have iCloud sync working in the simulator, where I signed in with my Apple ID on two simulators and it syncs fine. But when I upload the same build to TestFlight and install it on two of my physical devices, it does not sync. Each device behaves as if they only have a local store, eg. each can save and load fine locally. I already tried pushing my schema to production, but it still does not work, even when given 24 hours to see if it would sync. I have also tried restarting both devices and deleting and re-installing the app on both devices. I have also confirmed that iCloud is turned on in the settings app for my app.

I saw this post on Stackoverflow, which seems to be related to my issue, but the suggestions there did not work either. I also saw this post: https://www.hackingwithswift.com/forums/swiftui/swiftui-app-failing-to-sync-cloudkit-data-but-only-in-testflight-version/10714 However I did not understand the accepted answer, and none of the other suggestions worked either.