Skip to content

Instantly share code, notes, and snippets.

@jiro
Last active August 25, 2016 05:55
Show Gist options
  • Save jiro/17b7cf737e9e0aabf338 to your computer and use it in GitHub Desktop.
Save jiro/17b7cf737e9e0aabf338 to your computer and use it in GitHub Desktop.
WebエンジニアのためのiOSデバッグ速習会メモ@wantedly

イベント

#iosdebug_wantedly

題材

※ Xcode 7以上であれば以下でインストールできる

git clone https://github.com/artsy/eigen.git
cd eigen
bundle install
make oss
bundle exec pod install
open Artsy.xcworkspace

Xcodeにおけるデバッグ

📝 課題0

  • 題材アプリのインストール

前置き

  • Runしてアプリの全体像見てみる

デバッガの利用

  • ブレークポイントを利用してみる
    • 配置・除去
    • 有効化・無効化
    • 一覧の確認
  • コンソールを利用してみる
    • オブジェクトの確認
    • LLDBコマンドの実行

📝 課題1

  • アプリ起動時に呼ばれるメソッドにブレークポントを配置する
    1. ARAppDelegateクラスのapplication:didFinishLaunchingWithOptions:メソッドを見付ける
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    2. ブレークポイントを配置
    3. ビルド&ランしてブレークポイントで実行が止まることを確認

ビューデバッガの利用

  • アプリ実行中にデバッグボタンを利用してみる
    • ビュー構造の確認
    • タブの通知ボタンのクラスの特定
    • タブの通知ボタンの描画箇所の特定

📝 課題2

  • 検索ボタン(画面右上)
    1. クラスを特定する
    2. 描画箇所を特定する

chiselの利用

📝 課題3

  • chiselのインストール
    1. brew update && brew install chisel
    2. ~/.lldbinitの編集
  • 検索ボタン(画面右上)
    1. taplogコマンドを利用してクラスを特定する

クラッシュの原因の特定

  • Facebookサインアップの押下でクラッシュ
    • Facebookサインアップボタンのクラスの特定
    • Facebookサインアップボタンのアクション処理のメソッドの特定
    • ブレークポイントを利用した原因の調査

📝 課題4

  • Facebookサインアップボタン
    1. 押下のクラッシュを再現してみる
    2. 例外用のブレークポイントを利用してみる (Exception Breakpoint)

おまけ

📝 発展課題

  • PonyDebuggerを利用して通信内容を確認してみる
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment