Hook 的时候找不到.h头文件,请大神门指点

> Making all for tweak cntv_hook…

==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (arm64)…
Tweak.xm:3:9: fatal error: ‘UIViewController.h’ file not found

#import "UIViewController.h"
        ^
1 error generated.
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

#import "HomeViewController.h"
%hook HomeViewController
- (void)viewDidAppear:(BOOL)animated{
    %orig;
    //[super viewDidAppear:animated];
    UIAlertController *alertVC=[UIAlertController alertControllerWithTitle:@"" message:@"测试" preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *acttion1=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                    
                }];
                [alertVC addAction:acttion1];

                [self presentViewController:alertVC animated:YES completion:nil];
}

%end

大神门

你引入的"HomeViewController.h" 是classdump出来的?最简单的方式就是手动修复一下这个头文件就好了

是啊 是我dump出来的, 报错是viewcontroller.m 说没有啊

这个注释掉试试?没有直接import这个文件的。