Quantcast
Channel: 睿论坛 - 最新话题
Viewing all articles
Browse latest Browse all 5702

第一个Alert示例,正常启动不显示Alert

$
0
0

@MotoSc wrote:

第一个示例,安装成功了,但是手机重启后还是正常的开机了。论坛翻遍了,好多办法都试过了,还是不显示alert。求各位大神帮助帮助。PS:机型iPhone6 iOS9.3

Makefile:
THEOS_DEVICE_IP = 192.168.31.204
ARCHS = armv7 arm64 armv7s
TARGET = iphone:latest:7.0
include theos/makefiles/common.mk

TWEAK_NAME = iOSREGreetings
iOSREGreetings_FILES = Tweak.xm
iOSREGreetings_FRAMEWORKS = UIKit

include $(THEOS_MAKE_PATH)/tweak.mk

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

代码如下:

%hook SBLockScreenManager

- (void)lockUIFromSource:(NSUInteger)source withOptions:(id)options
{
	UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"标题" message:@"这个是UIAlertController的默认样式" preferredStyle:UIAlertControllerStyleAlert];
	UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:nil];
	UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
	[alertController addAction:cancelAction];
	[alertController addAction:okAction];
	[self presentViewController:alertController animated:YES completion:nil];
}

%end

%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application
{
	%orig;
	NSLog(@"****");
	UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"liuqi" message:@"liuqiqiq" delegate:self cancelButtonTitle:@"cool" otherButtonTitles: nil];
	[alertView show];
	[alertView release];
}

%end

Posts: 3

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5702

Trending Articles