消除iPhone手机上的提示小红点数字

每次打开手机,都会有各种通知提示,抑或是微信消息通知,对于强迫症患者真的是。。。
当然,你可以把每一个手机里面app通知都关掉,不过,有点费劲,今天,我们用技术把所有的小红点一次性消除,以后再也不会出现小红点了。
我们知道,在iOS系统中,手机显示的界面其实是SpringBoard,因此,我们想要隐藏通知小红点,就要在SpringBoard上找到小红点。

那么,如何找到SpringBoard呢?

首先链接手机,列出手机所有应用,查找到SpringBoard(这步不会的,请点击这里)
在这里插入图片描述进入SpringBoardcycript -p SpringBoard,然后倒入头文件@import mjcript
利用MJRootVc()可以找到根控制器SBHomeScreenViewController。
在这里插入图片描述

利用MJSubviews(#0x10bee0b20.view)可以找到根控制器下的所有view。
在这里插入图片描述通过观察,我们发现了SBIconView这个view,通过执行对某一个SBIconView的hidden = YES操作,可以发现一下现象:我的奇迹背单词app消失了!
在这里插入图片描述
因此,我们可以得出一个结论:每一个SBIconView代表一个app显示的Icon
然后,继续观察SBIconView,我们发现了SBIconParallaxBadgeView这个字段就是小红点的view。

在这里插入图片描述然后,我们只需还要把它隐藏或者frame为nil即可。

那么,如何才能把这个SBIconParallaxBadgeView隐藏或者其他操作呢?

首先,我们通过上面的ps -A | grep Sprin指令可以找到SpringBoard的安装地址/System/Library/CoreServices/SpringBoard.app/SpringBoard,通过iFunBox工具,可以找到该文件
在这里插入图片描述
然后,把SpringBoard拷贝出来,放置桌面或其他地方。

接下来,我们执行一条指令,该指令可以把SpringBoard文件中所有的.h文件解析出来。对,就是这么?

class-dump -H SpringBoard -o Headers
然后,我们可以发现多出了一个Headers文件夹
在这里插入图片描述
该文件夹里面就包含了所有的SpringBoard文件中.h文件

通过对文件搜索SBIconParallaxBadgeView,可以在该文件夹中找到该文件

在这里插入图片描述
我们只需要把这个文件中的- (id)init对象方法重写,返回nil即可做到SBIconParallaxBadgeView创建不成功,也就达到了小红点不出现的目的。

那么,如何才能重写- (id)init对象方法呢?

这就涉及到hook了,具体什么是hook如何hook请移步这里。

因此,我们做如下操作:

nic.pl
NIC 2.0 - New Instance Creator
------------------------------
  [1.] iphone/activator_event
  [2.] iphone/application_modern
  [3.] iphone/cydget
  [4.] iphone/flipswitch_switch
  [5.] iphone/framework
  [6.] iphone/ios7_notification_center_widget
  [7.] iphone/library
  [8.] iphone/notification_center_widget
  [9.] iphone/preference_bundle_modern
  [10.] iphone/tool
  [11.] iphone/tweak
  [12.] iphone/xpc_service
Choose a Template (required): 11
Project Name (required): tweak_sb
Package Name [com.yourcompany.tweak_sb]: com.yz.sb
Author/Maintainer Name [lsdt]:
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.apple.springboard
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]:
Instantiating iphone/tweak in tweak_sb/...
Done.

其中:
nic.pl:创建新的项目
Choose a Template:项目类型,这里我们选择tweak项目类型
Project Name (required):项目名
Package Name [com.yourcompany.tweak_sb]:插件的唯一标示
Author/Maintainer Name :作者
[iphone/tweak] MobileSubstrate Bundle filter:需要hook应用的唯一标示,本例中,springboard的bundleId@"com.apple.springboard",可在cycript下,通过MJAppId得到。

然后,我们就可以得到tweak_sb文件

在这里插入图片描述
把tweak_sb整个文件夹拖入到Sublime Text中

在Tweak.xm文件中,我们hook了SBIconParallaxBadgeView对象中的- (id)init方法,使其初始化时为nil

%hook SBIconParallaxBadgeView

- (id)init{
	return nil;
}

%end

这样就把原有的init方法给重写了,到达了小红点不会被创建的目的。

那么,如何才能把我们修改好的代码注入到源代码中呢?

首先,我们需要把Makefile文件中添加以下代码:

export THEOS_DEVICE_IP=127.0.0.1
export THEOS_DEVICE_PORT=2222

这两行代码是找到设备的ip与端口,因为是用ssh链接的手机,因此,ip就是本地ip,即localhost也就是127.0.0.1;端口需要看你自己手机端口,具体可参考如何打开ssh通道

然后在tweak_sb文件下执行以下三个命令:

  1. make 对文件进行编译
  2. make package 对文件打包,打包完后会有一个packages文件夹,文件夹下有一个.deb文件
    在这里插入图片描述
  3. make install 对.deb文件进行安装,并让springboard重启
    安装过后,可以在Cydia中发现自己修改的.deb插件
    在这里插入图片描述

也可以直接执行 make && make package && make install
其中,A && B 表示:先执行A命令,A命令没有问题再执行B命令

手机springboard重启后,就看不到通知小红点啦

在这里插入图片描述


中间可能会遇到的问题:

在make中可能会遇到以下问题:

问题1:
 Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [tweak_sb.all.tweak.variables] Error 2

这是因为tweak_sb文件夹目录上有中文,因此,建议tweak_sb文件夹上目录中,都用英文命名


问题2:
> Making all for tweak tweak_sb…
==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (armv7)…
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the
      libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the
      libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the
      libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the
      libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
While building module 'Foundation' imported from /Users/lsdt/theos/Prefix.pch:11:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from <module-includes>:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: fatal error:
      could not build module 'Darwin'
#include <sys/types.h>
 ~~~~~~~~^
error: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the
      libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]

自己网上查了很多资料,最后发现这种方法是好使的,即将Xcode->preperences->Locations->Command Line Tool选中Xcode9.4.1。(**注意:**在你开发app的时候,记得切换成Xcode10)

这样就可以打包成功。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值