Found the solution. My data file is located in the Preview Content folder in my project. For some reason this is OK when running the app in any simulator, however when running in TestFlight the data file must be in the man app folder. Once I moved it there the problem was solved.