如何使用Xcode 4断点操作

时间:2022-09-07 22:51:36

I want to use Xcodes capabilities to log certain data. In fact it should be quite simple to achive something similar to

我想使用Xcodes功能来记录某些数据。事实上,获得类似的东西应该很简单

NSLog(@"Size: %@", NSStringFromRect(self.view.frame));

with the Log Message action of a breakpoint. I tried variations of this:

使用断点的日志消息操作。我试过这个变种:

Size: @NSStringFromRect([[self view] frame])@

but failed.

但失败了。

I already searched the Xcode documentation and was surprised how bad that feature is documented. The only bit of information I was able to find was about how configuring at sound playing action when hitting breakpoints.

我已经搜索了Xcode文档,并对这个功能记录得有多糟糕感到惊讶。我能找到的唯一信息是关于在击中断点时如何配置声音播放动作。

2 个解决方案

#1


8  

How about

怎么样

Size: @(CGRect)[[self view] frame]@

#2


3  

Another solution would be:

另一种解决方案是:

Size: @(const char *)[[[[some objects] object] description] UTF8String]@

The output is not as nice as the one in fourplusone answer but it will work with all objects which provide a good description.

输出不如fourplusone答案那样好,但它适用于提供良好描述的所有对象。

#1


8  

How about

怎么样

Size: @(CGRect)[[self view] frame]@

#2


3  

Another solution would be:

另一种解决方案是:

Size: @(const char *)[[[[some objects] object] description] UTF8String]@

The output is not as nice as the one in fourplusone answer but it will work with all objects which provide a good description.

输出不如fourplusone答案那样好,但它适用于提供良好描述的所有对象。