Mac安装Lookin
手机安装LookinLoader
- 打开Cydia,搜索LookinLoader
- 打开设置-Lookin-Enable Applications,选择调试的app
手机导入Lookin Framework
- 打开Mac Lookin,找到Lookin Framework
- 拖拽Lookinserver.framework到手机(/usr/bin/Lookin)目录下,可以使用爱思助手将文件导入手机
重启手机
- 终端连接手机
ssh root@192.168.1.xx
密码 alpine
// 重启SpringBoard
killall SpringBoard
运行
Mac打开Lookin,手机打开要调试的app
在手机上使用
使用摇一摇,触发
#ifdef DEBUG
#pragma mark --摇一摇功能
//让当前控制器成为第一响应者,只有这样才能接收事件,所以此段代码必须加到控制器中
- (BOOL)canBecomeFirstResponder
{
return YES;// default is NO
}
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
NSLog(@"开始摇手机");
}
\
-(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
NSLog(@"结束");
if (motion == UIEventSubtypeMotionShake) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"调试" message:@"Lookin功能列表" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"导出为 Lookin 文档" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"Lookin_Export" object:nil];
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"进入 2D 模式" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"Lookin_2D" object:nil];
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"进入 3D 模式" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"Lookin_3D" object:nil];
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
}
}
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
NSLog(@"取消");
}
#endif