hook logos錯誤

我在學習hook logos語法但遇到了錯誤

#import <CaptainHook/CaptainHook.h>

%hook ViewController       錯誤代碼Expected identifier or '('
    
    - (void)testFunc {
        // 在原始函式之前執行的程式碼
        NSLog(@"Before testFunc is called.");
        
        // 調用原始函式
        %orig;
        
        // 在原始函式之後執行的程式碼
        NSLog(@"After testFunc is called.");
    }

%end                       錯誤代碼Expected identifier or '('


CHConstructor {
    %init(ViewController);
    %hook(ViewController);
}

請問如何解決

参考GPT和自己的思路:这个错误可能是因为在当前代码块之前缺少对应的标识符或括号导致的。请检查代码是否缺少了对应的标识符或括号,或者尝试在当前代码块之前添加必要的标识符或括号来解决此问题。