1-在AppDelegate.m的didFinishLaunchingWithOptions方法根据Xcode版本添加相应代码:
Xcode 10.2 and later:
#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
//for tvOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle")?.load()
//Or for macOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle")?.load()
#endif
Xcode 10.1:
#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle")?.load()
//for tvOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/tvOSInjection10.bundle")?.load()
//Or for macOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection10.bundle")?.load()
#endif
2-在需要调试的 类中添加实例方法 - (void)injected,将修改控件的代码写在这里面。
3-打开InjectionIII工具,选择Open Project,选择你项目的路径( .xcodeproj 文件所在的目录。),然后点击Select Project Directory保存。File Watcher选项要保持选中状态.
4-先在Xcode运行一下你的项目,控制台提示如下信息,即表示InjectionIII连接成功,连接成功InjectionIIIlogo会变为黄色。
网友评论