在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

最新文章

  1. Java transient关键字使用小记
  2. 二模12day1解题报告
  3. rpm -qc 来查找安装包的配置文件
  4. DDD 领域驱动设计-看我如何应对业务需求变化?
  5. word - 如何让 图片任意移动
  6. [大牛翻译系列]Hadoop(6)MapReduce 排序:总排序(Total order sorting)
  7. vim高亮显示
  8. 如何在标题栏的title前添加网站logo
  9. unity A*寻路 (一)导出NavMesh数据
  10. UE4联机多人游戏基本设置
  11. Android开发—— Tablayout的使用
  12. LeetCode算法题-Kth Largest Element in a Stream(Java实现)
  13. Python并发编程之IO模型
  14. windows cmd命令 批处理bat 导增量jar包【原】
  15. 01. Numpy模块
  16. 初识Vulkan【转】
  17. [c/c++] programming之路(18)、动态分配内存malloc
  18. hive 踩坑
  19. 【LOJ】#2073. 「JSOI2016」扭动的回文串
  20. RAR压缩包审计工具unrar-nofree

热门文章

  1. linux环境下安装mongodb
  2. Xcode 升级成Xcode 8 版本以后,出现 Signing for &quot;sqlite3--test&quot; requires a development team. 问题的解决
  3. Mini projects #3 ---- Stopwatch: The Game
  4. TSP旅行商问题的Hopfield求解过程
  5. Mac下git命令自动补全
  6. 查看上下文切换的多的进程(find which process take the most context switch)
  7. No operation was found with the name {http://impl.service.xq.com/}sayHi
  8. selenium 富文本框处理
  9. HTML5的文档结构和新增标签
  10. postfix下dovecot查收邮件连接错误