14
6

More than 3 years have passed since last update.

iOSアプリのエントリーポイントを調べる手順書

Last updated at Posted at 2017-07-28

前提

  • Xcode 8.2.1で確認した
  • 探す対象
    • UIApplicationDelegateを実装した使用するクラス
    • 最初に使用するUIViewController系クラス
      • 必然最初に使用するStoryboardも

本題

UIApplicationDelegateを実装した使用するクラスを探す

Objective-Cの場合

  1. main.mを探す
  2. UIApplicationMain()の引数になっているクラスを調べる
    • Xcodeでプロジェクト作成直後の場合
      • UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]))
      • AppDelegateがApplicationDelegateとして使用される

Swiftの場合

main.swiftがない
  1. プロジェクト全体に対して@UIApplicationMainの検索をかける
  2. プロジェクト全体に対して@mainの検索をかける
    • Deployment Target iOS 14 以降の場合
main.swiftがある
  1. main.swiftを開く
  2. UIApplicationMain()の引数になっているクラスを調べる
    • 例えば
      • UIApplicationMain(Process.argc, Process.unsafeArgv, nil, NSStringFromClass(AppDelegate))
      • AppDelegateがApplicationDelegateとして使用される

最初に使用するUIViewController系クラスを探す

1. Projectを開き、Targetを調べたいアプリに指定する

  • スクリーンショット 2017-07-28 13.31.01.png

2. Build SettingsからPackaging -> Info.plist Fileの項目を確認する

  • スクリーンショット 2017-07-28 13.21.03.png
  • Xcodeでプロジェクト作成直後の場合
    • プロジェクトディレクトリ名/Info.plist

3. Info.plistを開きMain storyboard file base nameの項目を確認する

  • スクリーンショット 2017-07-28 13.32.40.png
  • Xcodeでプロジェクト作成直後の場合
    • Main.storyboard
  • ちなみにInfo.plistを開きLaunch screen interface file base nameの項目を見ると、Launch時に使用するファイルの名前が確認できる。

4. 起動時に使用されるStoryboardを開き、Initial View Controllerを探す

  • スクリーンショット 2017-07-28 13.22.04.png
  • Xcodeでプロジェクト作成直後の場合
    • 素のViewControllerがある

5. Initial View ControllerのCustom Classを見る

  • スクリーンショット 2017-07-28 13.22.26.png
  • Xcodeでプロジェクト作成直後の場合
    • ViewController
14
6
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
6