Based on C, the iOS also has compile-time, link-time and run-time.

  1. Compile-time is when the compiler converts our code to machine instructions code.
  2. Link-time is when the linker puts together the compiled pieces and libraries to form an executable.
  3. Run-time is when the program runs. Issue at this moment is critical.

Compile-time

  1. Compile warnings: we have done something bad, it still can compile but should be fixed, as it will potentially causes errors (that are hard to find).
  2. Compile errors: a problem that the compiler does not accept – we have to fix it right now. Compiler will give the location of the error (file + line number).

Link-time

  1. Linking errors: the code compiles, but some functions or libraries needed are missing.

Run-time 

  1. Fatal errors: it crashes. They can be:
    • segmentation fault
    • bus error
    • divide by zero
  2. Logic errors: it hangs or behaves unexpectedly.
    • It can be a loop that can’t stop.
    • It can be a logic that makes you wait for ever for the resource (locking, connecting without timeout etc…)
    • It can be a race-condition issue which causes the app to behaves inconsistently every run.

Debugging tips:

  1. Simulator first, real device later; the differences between them are:
    • The iDevices file-system is case-sensitive, while simulator is running on OSX, and the HFS+ (Mac Filesystem) is defaulted to case-insensitive (if we need the Mac filesystem to be case-sensitive, we will need to format it and specifically choose the option when formatting). So sometimes, we can have this issue where the simulator can still find the files, but the real devices not.
    • The simulator has much more memory.
    • The simulator does not have some default apps like the AppStore app…
  2. Global exception breakpoint
  3. Use Static Clang Analyzer
  4. Treat warnings as errors:
  5. Use the AppStore Validate (before Submission) process
Advertisements