iOS-----Xcode-Debug尝试
2024-09-26 21:30:07
在Xcode中,Debug时,不能像eclipse ,或VS那些集成开发那样,能直接查看变量的值。那怎么在调试的时候查看XCode的变量呢?
有一些方法的。
1、新建一个Single View App
在viewDidLoad里添加些代码:
- (void)viewDidLoad
{
[super viewDidLoad]; NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"value1",@"key1",
@"28", @"age",@"rongfzh",@"name" ,nil]; UILabel *label = [[UILabel alloc] init];
label.frame = CGRectMake(20, 40, 250, 60);
label.text = [dic objectForKey:@"name"];
[self.view addSubview:label];
}
在最后一行打上断点。
2、"po" : print object 命令 打印出对象。
Command+R调试运行,在 Debug Console 上lldb上输入po dic回车,显示如下:
这就把词典内容打印出来了。
再打印label试试。
(lldb) po label
(UILabel *) $3 = 0x06a8bdd0 <UILabel: 0x6a8bdd0; frame = (20 40; 250 60); text = 'rongfzh'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x6a8be90>>
label的信息也打印出来了。
3、print命令
print (char*)[[dic description] cString]
(char *) $4 = 0x06d79760 "{\n age = 28;\n key1 = value1;\n name = rongfzh;\n}"
打印对象的retainCount,但对象被回收
(lldb) print (int)[label retainCount]
(int) $2 = 1
最新文章
- Java transient关键字使用小记
- 二模12day1解题报告
- rpm -qc 来查找安装包的配置文件
- DDD 领域驱动设计-看我如何应对业务需求变化?
- word - 如何让 图片任意移动
- [大牛翻译系列]Hadoop(6)MapReduce 排序:总排序(Total order sorting)
- vim高亮显示
- 如何在标题栏的title前添加网站logo
- unity A*寻路 (一)导出NavMesh数据
- UE4联机多人游戏基本设置
- Android开发—— Tablayout的使用
- LeetCode算法题-Kth Largest Element in a Stream(Java实现)
- Python并发编程之IO模型
- windows cmd命令 批处理bat 导增量jar包【原】
- 01. Numpy模块
- 初识Vulkan【转】
- [c/c++] programming之路(18)、动态分配内存malloc
- hive 踩坑
- 【LOJ】#2073. 「JSOI2016」扭动的回文串
- RAR压缩包审计工具unrar-nofree
热门文章
- linux环境下安装mongodb
- Xcode 升级成Xcode 8 版本以后,出现 Signing for ";sqlite3--test"; requires a development team. 问题的解决
- Mini projects #3 ---- Stopwatch: The Game
- TSP旅行商问题的Hopfield求解过程
- Mac下git命令自动补全
- 查看上下文切换的多的进程(find which process take the most context switch)
- No operation was found with the name {http://impl.service.xq.com/}sayHi
- selenium 富文本框处理
- HTML5的文档结构和新增标签
- postfix下dovecot查收邮件连接错误