我在iOS 5模拟器/设备中调试Xcode 4.2时遇到问题.正如预期的那样,以下代码崩溃:
NSArray *arr=[NSArray array];
[arr objectAtIndex:100];
Run Code Online (Sandbox Code Playgroud)
在iOS 4中,我获得了十六进制数的有用堆栈跟踪.但是在iOS 5中,它只是给了我:
*** First throw call stack:
(0x16b4052 0x1845d0a 0x16a0674 0x294c 0x6f89d6 0x6f98a6 0x708743 0x7091f8 0x7fcaa9 0x2257fa9 0x16881c5 0x15ed022 0x15eb90a 0x15eadb4 0x15eaccb 0x6f02a7 0x6faa93 0x2889 0x2805)
Run Code Online (Sandbox Code Playgroud)
谢谢.
我希望能够在调试器到达特定的字符串匹配时使其中断.举个例子,我可能会有这样的事情:
Foo myObj = [self gimmeObj];
Run Code Online (Sandbox Code Playgroud)
myObj可能有一个叫做的属性name.我希望调试器在分配时停止
[myObj.name isEqualToString:@"Bar"];
Run Code Online (Sandbox Code Playgroud)
如何在Xcode中设置条件断点来做到这一点?
是否有内置的方法,函数,API,普遍接受的方式等来转储Objective C中实例化对象的内容,特别是在Apple的Cocoa/Cocoa-Touch环境中?
我希望能够做类似的事情
MyType *the_thing = [[MyType alloc] init];
NSString *the_dump = [the_thing dump]; //pseudo code
NSLog("Dumped Contents: %@", the_dump);
Run Code Online (Sandbox Code Playgroud)
并显示对象的实例变量名称和值,以及可在运行时调用的任何方法.理想情况下,易于阅读的格式.
对于熟悉PHP的开发人员,我基本上寻找等效的反射函数(var_dump(),get_class_methods())和OO Reflection API.
您是否更愿意推荐使用 NSLog 或 Xcode 提供的日志记录功能作为断点进行调试?
使用 NSLog 有什么优点吗?
对于在客户设备上运行的应用程序:是否有一种简单的方法可以将 NSLog 或等效输出记录到文件或 Web 服务?
objective-c ×3
xcode ×3
ios ×2
breakpoints ×1
cocoa ×1
debugging ×1
logging ×1
nslog ×1
reflection ×1