Iphone PerformSelect在调试模式下未命中断点

Iphone PerformSelect在调试模式下未命中断点,iphone,xcode3.2,Iphone,Xcode3.2,当执行以下代码时 style = [self performSelector:sel withObject:(id)state]; sel中的断点未命中。这是正常的行为吗 NSString* key = state == UIControlStateNormal ? selector : [NSString stringWithFormat:@"%@%d", selector, state]; TTStyle* style = [_styles objectForKey:

当执行以下代码时

style = [self performSelector:sel withObject:(id)state]; 
sel中的断点未命中。这是正常的行为吗

NSString* key = state == UIControlStateNormal
    ? selector
    : [NSString stringWithFormat:@"%@%d", selector, state];
  TTStyle* style = [_styles objectForKey:key];
  if (!style) {
    SEL sel = NSSelectorFromString(selector);
    if ([self respondsToSelector:sel]) {
      style = [self performSelector:sel withObject:(id)state];
      if (style) {
        if (!_styles) {
          _styles = [[NSMutableDictionary alloc] init];
        }
        [_styles setObject:style forKey:key];
      }
    }
  }

Try style=[自执行选择器:@selector(sel)with object:(id)state]

在文章中的一条评论中,您提到这段代码来自three20style库,当您放置断点时,它不会被命中。可能发生的情况是,您正在遵循Three20链接Three20库的推荐实践:在构建设置的“其他链接器标志”部分,您可能有一大堆
-force load
参数,类似于这样:

-force-load libThree20UICommon.a -force-load libThree20.a ...
问题是,当您以这种方式链接时,断点不起作用。作为一种解决方法,仅在调试配置中(而不是在发行版配置中),从“其他链接器标志”中删除所有这些参数,并将其放入:

-all_load -ObjC

我不太熟悉这些旗帜之间的确切区别;我只知道,使用
-all_load-ObjC
可以让断点工作。我不建议更改发布配置的设置,因为我不确定更改的确切影响。

不,这不正常。尝试
[self respondsToSelector:sel]
并查看它是否返回
YES
,因此,函数确实响应此选择器。这是来自three20style代码的快照。我看到的是函数确实被调用,但返回的值不正确。当我放置断点时,它不是HIT,我更喜欢这里建议的伪类解决方案:确保将宏放在.m文件中,而不是头中,以避免重复的符号错误。