书上38页启动电话程序恶作剧 失败

书上38页用了一句话描述可用以下代码实现启动任意app都启动电话程序

- (BOOL)launchApplicationWithIdentifier:(id)identifier suspended:(BOOL)suspended
{
	return %orig(@"com.apple.mobilephone", suspended);
}

但是,这样写,实现不了,求教了。但是跑3.2.4的开发示例可以正常。

你的完整代码是怎么写的?hook的哪个类?filter是怎么写的?

makefile

THEOS_DEVICE_IP = 172.16.34.101
include theos/makefiles/common.mk
ARCHS = armv7
TARGET = iphone:7.1:4.3
TWEAK_NAME = MyFirstTweak
MyFirstTweak_FILES = Tweak.xm
MyFirstTweak_FRAMEWORKS = UIKit CoreTelephony CoreAudio
MyFirstTweak_PRIVATE_FRAMEWORKS = AppSupport ChatKit IMCore
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
	install.exec "killall -9 SpringBoard"
%hook SpringBoard
- (void)applicationDidFinishLaunching:(id)application
{
	%log((NSString *)@"执行了applicationDidFinishLaunching");
	%orig;
	UIAlertView *alert = [UIAlertView alloc] initWithTitle:@"Wahaha" message:@"haha" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
	[alert show];
	[alert release];	
}
- (void)_menuButtonDown:(struct __IOHIDEvent *)arg1
{
	NSLog(@"执行了menuButtonDown");
	%orig;
	UIAlertView *alert = [UIAlertView alloc] initWithTitle:@"Wahaha" message:@"XXOO" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
	[alert show];
	[alert release];
	
}
- (BOOL)launchApplicationWithIdentifier:(id)arg1 suspended:(BOOL)arg2
{
	return %orig(@"com.apple.calculator", arg2);
}
%end

Tweak.xm(前面两个方法都能执行,就是最后一个不行,不知道哪里搞错了,求教)

@snakeninny 还想反应一个网站的bug:发回复的时候,文字中有emoji出现的话,emoji以及之后的文字都会被截取掉。

你在最后一个函数里加个UIAlertView,看看弹不弹,就知道这里的hook是否成功了

加了Alert,没有弹出框,这个方法确实没有执行到。:3_58:

前面2个都执行了,说明程序本身是没问题的。你在ios几上做的测试?

iPod touch 5 - iOS 7.1.2 - 盘古越狱

那有一种可能,就是虽然这个函数还是可以用来启动App,但系统不再使用这个函数来做这件事了,等我有空了验证一下就知道了

恩恩,多谢大神,我也再找找这方面的内容