THEOS: compiling error when calling method in other class (logos)

余生颓废 提交于 2019-12-11 20:56:47

问题


i'm trying to implement this tweak using THEOS that calls another view on load
but i keep getting this error when i compile:
Tweak.xm:13:57: error: class method '+onLeftMenu' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access] [_logos_static_class_lookup$FoxTubeViewController() onLeftMenu];

my code Tweak.xm file:
%hook MainViewController - (void)viewDidLoad{ %orig; [%c(LeftMenu) onCachedVideo]; } %end


回答1:


if you need to use %c you should

#import "LeftMenu.h"

and if you don't want that you can call it from runtime using

#import <objc/runtime.h>

then call it like

[objc_getClass("LeftMenu") onCachedVideo];

GoodLuck



来源:https://stackoverflow.com/questions/26594145/theos-compiling-error-when-calling-method-in-other-class-logos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!