Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Debugging in Swift

Debugging in Swift

This talk will give you some helpful tips and tricks when you struggle with Debugging

Carola Nitz

March 22, 2015
Tweet

More Decks by Carola Nitz

Other Decks in Technology

Transcript

  1. How debugging should be like • Get to the content

    of interest @_Caro _N, 22/3/2015
  2. How debugging should be like • Get to the content

    of interest • Get helpful error messages @_Caro _N, 22/3/2015
  3. How debugging should be like • Get to the content

    of interest • Get helpful error messages • Display additional information where needed @_Caro _N, 22/3/2015
  4. How debugging should be like • Get to the content

    of interest • Get helpful error messages • Display additional information where needed • Know about debugging tools @_Caro _N, 22/3/2015
  5. Magic command (lldb) expression -l objc -O -- (id) 0x00007fbaa1f24910

    I'm a fancy Objective-C String @_Caro _N, 22/3/2015
  6. Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw

    or catch • Catch OpenGL ES errors @_Caro _N, 22/3/2015
  7. Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw

    or catch • Catch OpenGL ES errors • Stop when executing a specific function or method @_Caro _N, 22/3/2015
  8. Projectwide Breakpoints • Catch Objective-C or C++ Exceptions on throw

    or catch • Catch OpenGL ES errors • Stop when executing a specific function or method • Stop when test Assertions fail @_Caro _N, 22/3/2015
  9. Localization • -NSDoubleLocalizedStrings 1 • -NSShowNonLocalizedStrings 1 • -AppleLanguages (es

    de) Technical Note TN2239 iOS Debugging Magic @_Caro _N, 22/3/2015
  10. Swift REPL • Test and interact with your app •

    Add new code • Clean slate xcrun swift in the terminal @_Caro _N, 22/3/2015
  11. Activity Tracing Trace crashes in asynchonous code os_activity_t activity =

    os_activity_start("activity name", OS_ACTIVITY_FLAG_DEFAULT); // [...] os_activity_set_breadcrumb("event description"); // [...] os_trace("Received %d creates, %d updates, %d deletes", created, updated, deleted); // [...] os_activity_end(activity); @_Caro _N, 22/3/2015
  12. Summary • expression -l objc -O -- (id) 0x00007fbaa1f24910 •

    Edit Breakpoints, add symbolic and exception breakpoints • Tackle incomprehensive compiler errors • Launch arguments • Charles, REPL, Activity tracing @_Caro _N, 22/3/2015