MonkeyDev-Logos Tweak初识

2020-03-24  本文已影响0人  lmfei

LogosTweak,可以帮我们在不用重签名的情况下进行代码的动态注入,它的使用前提是在越狱设备上,下面记录下新建项目的效果,以及在使用时遇到的坑

创建第一个LogosTweak项目

在这里我做了一个端口的映射,在我们运行项目前如果没有做映射则在编译时会报错

Creating zip /Users/liumingfei/Desktop/HelloLogosTweak/Packages/com.lmf.HelloLogosTweak_0.1-1_iphoneos-arm.zip... Done.
ssh: connect to host localhost port 2222: Connection refused
ssh -p2222 root@localhost mkdir -p "/var/root/MonkeyDevPackages"
Command PhaseScriptExecution failed with a nonzero exit code

所以在运行前需要先做下端口映射,这里使用的是

iproxy 2222 22 
An empty identity is not valid when signing a binary for the product type 'Dynamic Library'.

碰到这个问题,需要在该项目的target的build settings 中添加一个参数

Add User-Defined Setting

点击Add User-Defined Setting


CODE_SIGNING_ALLOWED

添加CODE_SIGNING_ALLOWED=NO,重新编译,编译成功

#import <UIKit/UIKit.h>
%hook SpringBoard

- (void)applicationDidFinishLaunching:(id)application {
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello"message:@"My LogosTeak Tip!!!"delegate:self cancelButtonTitle:@"OK"otherButtonTitles:nil];
        [alert show];
        %orig;
}

%end

连接设备Cmd + B,Build Successed


Build Successedg

工程目录介绍

工程目录
注:在装MonkeyDev的环境时,一定要做免密设置或者安装sshpass.,这里在安装sshpass时失败,所以在运行时报错
 Command /bin/sh failed with exit code 1
解决就是安装好sshpass,即可
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
使用官网的安装路径一直失败的话,可以用下面的一条
brew install http://git.io/sshpass.rb

生活如此美好,今天就点到为止。。。

上一篇下一篇

猜你喜欢

热点阅读