2

I have a iOS Swift app. I recently added a feature and uploaded the new version to TestFlight. For some reason, the main function for this new feature is not being called in release mode, but works perfectly in debug mode.

What I tried so far: within 'Apple LLVM 6.0 - Code Generation' for Release
1) Changed Optimization Level to None, and
2) Changed 'Symbols Hidden By Default' to No

I do not believe that the function's specifics matter here, but for what it's worth: it receives and manipulates some JSON data from the backend. I have ten other functions which do exactly the same thing for different types of data - not facing the same problem there.

Any ideas around this? What other differences are there between Release Mode and Debug Mode? that might be a good start to troubleshoot.

Thanks,

ANaimi
  • 6,266
  • 7
  • 32
  • 32
  • I actually just ran into something very similar. I'm still trying to debug which is difficult in release mode. I added some `println` around and believe it or not it started working. I think the compiler is trying to optimize by reordering instructions and perhaps getting it wrong. May worth putting some `println` statements around and see if that helps you too (temporarily at least) – Oren Jul 29 '15 at 00:03

2 Answers2

0

What other differences are there between Release Mode and Debug Mode?

Aside from different device architectures, there's a DEBUG preprocessor macro that is excluded in Release.
You can make a scheme that allows you to debug in Release mode, and check where it breaks.

Schemetrical
  • 5,506
  • 2
  • 26
  • 43
0

Assertions will not run in release mode. Sometimes people make this mistake (I've made it a few times over the years):

assert(doSomethingImportant(), "Failed")

This works in Debug, but doSomethingImportant doesn't get called in Release.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610