6월, 2013의 게시물 표시

TIP - Check ambiguous layout in Xcode debugger

How can I check auto layout issue of iOS application from Xcode? Easy. Run your application Pause by debugger Type the following command from debug console: (lldb) po [[UIWindow keyWindow] _autolayoutTrace] You can see the trace from debug console such as: *<UIWindow:0x9980df0> |   *<UIView:0x8eb2fd0> |   |   *<UISwitch:0x8eb31b0> |   |   |   <_UISwitchInternalViewNeueStyle1:0x8eb3540> |   |   |   |   <UIView:0x8eb3ac0> |   |   |   |   |   <UIView:0x8eb3840> |   |   |   |   <UIView:0x8eb3a10> |   |   |   |   |   <UIView:0x8eb38f0> |   |   |   |   <UIImageView:0x8eb3da0> |   |   *<UISlider:0x8eb61d0> - AMBIGUOUS LAYOUT |   |   |   <UIView:0x8eb9290> |   |   |   |   <UIView:0x8eb9af0> |   | ...

WWDC 2013 - Advances in Objective-C (404) Summary

Using a Framework #import model issue Header fragility Non-scalable compile time pre-compiled headers help significantly - maintenance burden / namespace pollution Modules solve these issues @import iAd; Doesn't need to parse headers Local macro definitions have no effect on framework API  Autolinking - don't need to "link binary with libraries" Selective import @import iAd.ADBannerView; Using Modules #import and #include automatically mapped to @import No source changes required Mac OS X Mail shows 40% faster compile time with modules - didn't manage pre-compiled headers well  For old project, enables it manually through the GUI Build Settings / Apple LLVM 5.0 - Language - Modules / Enable Modules Modules are not available for user framework Tools support for modernisation Edit / Refactor / Convert to Modern Objective-C Syntax … Explicit Enums NS_ENUM, NS_OPTIONS Tagged Pointers Added to 64 bit Cocoa For...

WWDC 2013 - Advanced debugging with LLDB Summary

이미지
Finding problems Debug-only assertions NSAssert NS_BLOCK_ASSERTIONS disables assertions in release builds Log effectively with ASL (Apple System Log) ASL_LEVEL_EMERG ASL_LEVEL_DEBUG Use hash tags like #web in log messages Have switches for the heaviest logging (e.g. NSUserDefaults) Validate your program with Xcode WWDC 2010 Advanced memory analysis with instruments WWDC 2013 What's new in the LLVM compiler Stopping before problems occur Breakpoints Stop at a source line: b MyView.m:4 Stop at a method: b "-[MyViewA drawRect:]" Stop whenever any object receives a selector: b drawRect: Breakpoint commands run each time a breakpoint is hit (e.g. backtrace and continue) br co a > bt > c > DONE Can be done also from GUI Find when a method is called on a specific instance (lldb) p id $myModel = self   --> create a persistent variable (lldb) b "-[MyModel dealloc]" (lldb) br m -c "self == $myMo...

LLDB features and WWDC sessions

Let's check interesting LLDB (Xcode debugger) features maybe you don't know until yet. Please find full documentation about LLDB from  here . Alias You can make a few alias for commonly used commands. for example, (lldb) command alias bfl breakpoint set -f %1 -l %2 (lldb) bfl Test.m 15 You can store all aliases to  ~/.lldbinit  file. LLDB will read this file at startup. Regular expression alias You can use regex to make alias (lldb) command regex f "s/^([0-9]+)/frame select %1/" (lldb) f 12  --> frame select 12 Type summary If you want to display summary for custom classes or structures, you can add type summary (lldb) type summary add --summary-string "x=${var.x} y=${var.y}" MyPoint You also can write a Python script that returns the string to be used as summary. Please see   LLDB documentation Expression Evaluating generalized expression in the current frame (lldb) expr (int) printf("Print nine: %d", 5 + 4) Python ...

Java path from Mac OS X

Where is my Java SDK from Mac OS X with Oracle's JVM installing. Easy way to find out it is running the below command from the terminal. /usr/libexec/java_home Can be a good idea to add JAVA_HOME to your .bash_profile file. such as > vim ~/.bash_profile Add the below line from vim. export JAVA_HOME=`/usr/libexec/java_home` Save file. Done.

Xcode 5 - comment for documentation

New feature of Xcode 5. You can document your own code as like the below: /*! Add new message between source to destination timeline as empty name string  * \param sourceId Source timeline entity ID  * \param destId Destination timeline entity ID  * \returns A newly created message instance  */ - ( ISMessage *)messageFromTimeline:( NSInteger )sourceId toTimeline:( NSInteger )destId; You can use Doxygen format for documentation.  Then you can see the documentation of this function from Xcode 5 UI (by using Quick Help or Option-Click).  Very easy! The following comment styles are also possible. /**   * Add new message between source to destination timeline as empty name string  * @author Wonil Kim  *  * @param sourceId Source timeline entity ID  * @param destId Destination timeline entity ID  * @return A newly created message instance  */ - ( ISMessage *)messageFromTimeline:( NS...