iOS 提高开发效率-热加载

偶然看到一款软件,挺好用的推荐一下:InjectionIII

首先将InjectionIII从App Store下载安装到自己的Mac,然后在

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

里面添加一段demo,如下:

#ifdef DEBUG

        // for iOS

    [[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle"] load];

    // for tvOS

    [[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle"] load];

    // for masOS

    [[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle"] load];

#else

    

#endif


然后在需要使用的地方添加

-(void)injected{

    NSLog(@"I've been injected: %@", self);

    [self viewDidLoad];

    

}

或者直接将这个方法写在写在基类默认调用,修改完成之后直接 command+s完成修改

你可能感兴趣的:(iOS开发)