I have a watch companion app that sends several message to the iPhone and the phone replies with the data the watch needs. This works perfectly on the simulator and when I deploy directly from XCode to my phone/watch. However, when deployed to test flight the watch never receives replies from the phone. I've added logging and WCSession is active, WCSession.isSupported is true and WCSession.isReachable is true. The watch just doesn't receive a reply from the phone. Is there something I have to put in the Plist to make this work in Test Flight? Has anyone ever had a similar problem?
Apple Watch Companion App Works only on Simulator and My Hardware
I figured this out on my own. What's going on is there is a compiler optimizer that runs in release mode that was causing one of the while loops to be skipped. I can't help but wonder if this is a bug in the optimizer. To fix it, I went into build settings/Swift Compiler - Code Generation and set the optimizer to No Optimization [-Onone] for the release build. Now, the code is working everywhere. On a side note, you can run your code in release mode inside XCode by editing the scheme and choosing release. This will allow you to see how your code will behave in prod or Test Flight without deploying it.