Is it possible to check in code if the app was started or published by TestFlight?
Can't you do this at compile time?
#if TESTFLIGHT
public const bool IsTestFlightBuild = true;
#else
public const bool IsTestFlightBuild = false;
#endif
Then in your project's settings, create a build configuration TestFlight|iPhone
with TESTFLIGHT
set. Only publish to TestFlight with this build configuration.