قالب وردپرس درنا توس
Home / IOS Development / # 289: Shows log messages in apps with TinyConsole 📃📲 – Small pieces of cocoa

# 289: Shows log messages in apps with TinyConsole 📃📲 – Small pieces of cocoa



Subjects

Topics

Xcode offers a wealth of great troubleshooting tools. Sometimes, we will still be able to troubleshoot or evaluate the features of our app without having to be linked to Xcode's debugger.

Today we check out TinyConsole by Devran Ünal, a library that lets us easily view our log messages directly in our app. Let's take a look.

We install TinyConsole in our app, and change some code in our AppDelegate to set it up.

Instead of assigning our rootscreen control to this: [] ] [1

9659000]] rootViewController = SpaceshipsViewController () [19659000] will pack our rotation display controls into a TinyConsoleController :

    Window    =    TinyConsoleController   (
    rootViewController :    SpaceshipsViewController   () 
). [19659016] That's it. Now all we need to do is add some log messages throughout our code. We can do this with conversations like: 

  TinyConsole .   print   (  "spacecraft id:    ( spacecraft .  id  ])  " ) 

We launch our app and try it out. When you drive on a device, we can only shake the device to show / hide the console view. [19659000] Pro Tip: Press ⌘ ^ Z to simulate a shake in iOS Simulator ).

Cult! TinyConsole does not stop there, but we can also use colors:

  TinyConsole .   print     "Crew Member Saved!"    color  :    UIColor .  green ) 

and add Markers:

  TinyConsole .   addMarker   () 

Finally, there are some more We can sweep to add a Marker, 2 finger prints to log something manually, or press 3 fingers to display an action sheet that lets us send our log messages as an email.

Learn more about TinyConsole at git.io/tinyconsole


Source link