Tweak创建锁屏提示简单工程

2017-08-11  本文已影响181人  幻想无极

效果:当iphone锁屏弹出一个提示

cd LockScreenTest
export THEOS=/Users/tqh/theos
/Users/tqh/theos/bin/nic.pl
 11

工程目录

0BEEF9ED-5EEF-4F54-ADD0-408FDDA9A5EE.png

Makefile文件

ARCHS = armv7 armv7s arm64
SDKVERSION = 10.3
TARGET = iPhone:clang:10.3:7.0
include $(THEOS)/makefiles/common.mk

TWEAK_NAME = Alert
Alert_FILES = Tweak.xm

include $(THEOS_MAKE_PATH)/tweak.mk

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

Tweak.xm文件

找到对应的类文件SBLockScreenManager.h其中有方法

- (void)lockUIFromSource:(NSUInteger)source withOptions:(NSDictionary *)options

代码实现


%hook SBLockScreenManager

- (void)lockUIFromSource:(NSUInteger)source withOptions:(NSDictionary *)options{
    %orig;
    
    UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:@"这是个锁屏测试" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
    
    [alertView show];
}

%end

常用Logos语法简介

control

control文件中存储的内容记录了deb包管理系统所需的基本信息,会被打包进deb包里。下方就是control中内容,其中存储的就是一些包名、工程名、版本、作者等等,与打包安装后在Cydia中看到的信息相同。
工程demo:
https://github.com/tqhnet/Tweak-Alert
参考链接:
http://security.ios-wiki.com/issue-3-6/
http://www.cnblogs.com/ludashi/p/5714095.html

上一篇 下一篇

猜你喜欢

热点阅读