【问题标题】:My theos tweak stops working after adding a custom dylib file to it在向其添加自定义 dylib 文件后,我的 theos 调整停止工作
【发布时间】:2017-07-24 08:51:04
【问题描述】:

我创建了一个简单的调整,使用Theos,将黄色的 UIView 添加到应用程序窗口(没什么特别的),并且效果很好。然后我用一种方法制作了一个 dylib 文件(称为 AlertLib),其中包含一个类(也称为 AlertLib):显示一个简单的UIAlertView。我将 AlertLib.dylib 复制到 /opt/theos/lib 文件夹,并将 AlertLib.h 复制到 /opt/theos/include 文件夹。

我的 Makefile 看起来是这样的:

export ARCHS = armv7 arm64
export TARGET = iphone:clang:latest:8.0

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = YellowSquare
YellowSquare_FILES = Tweak.xm
YellowSquare_FRAMEWORKS = UIKit Foundation
YellowSquare_LDFLAGS = -lAlertLib

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
    install.exec "killall -9 SpringBoard"

Tweak.xm 文件看起来是这样的:

#import "AlertLib.h"

%hook AppDelegate

- (void) applicationDidBecomeActive:(UIApplication *) application
{
    static dispatch_once_t once;
    dispatch_once(&once, ^{

        UIView *yellowSquareView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        yellowSquareView.backgroundColor = [UIColor yellowColor];

        UILabel *tweakLabel = [[UILabel alloc] initWithFrame:yellowSquareView.bounds];
        tweakLabel.backgroundColor = [UIColor clearColor];
        tweakLabel.text = @"TWEAK";
        tweakLabel.font = [UIFont systemFontOfSize:25];
        tweakLabel.textAlignment = NSTextAlignmentCenter;
        [yellowSquareView addSubview:tweakLabel];

        UIWindow *window = [UIApplication sharedApplication].keyWindow;
        yellowSquareView.center = window.center;
        [window addSubview:yellowSquareView];

        [[AlertLib sharedInstance] showAlert];
    });

    %orig;
}

%end

之后,我编译了调整,并将其安装到设备上,没有错误。但是,现在调整不起作用,即在应用程序的窗口上没有添加黄色视图,也没有显示警报。如何正确嵌入自定义 dylib 文件进行调整?

【问题讨论】:

    标签: ios jailbreak theos tweak


    【解决方案1】:

    从外观上看,我的赌注是AlertLib 没有安装在设备上。如果“不工作”意味着应用程序崩溃,情况就是如此。
    如果可能,我想请求详细定义“不工作”并编译 dylib。

    【讨论】:

      【解决方案2】:

      我通过将我的自定义库作为子项目添加到我的调整中解决了我的问题。 我在我的调整根目录中运行命令/opt/theos/bin/nic.pl,然后从列表中选择library。它被自动添加为子项目。然后我将需要的文件添加到我的库中,并且它起作用了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-03-11
        • 2018-05-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多