Post

Replies

Boosts

Views

Activity

Reply to 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.
Mar ’24