1. <i id='MK0rJ'><tr id='MK0rJ'><dt id='MK0rJ'><q id='MK0rJ'><span id='MK0rJ'><b id='MK0rJ'><form id='MK0rJ'><ins id='MK0rJ'></ins><ul id='MK0rJ'></ul><sub id='MK0rJ'></sub></form><legend id='MK0rJ'></legend><bdo id='MK0rJ'><pre id='MK0rJ'><center id='MK0rJ'></center></pre></bdo></b><th id='MK0rJ'></th></span></q></dt></tr></i><div id='MK0rJ'><tfoot id='MK0rJ'></tfoot><dl id='MK0rJ'><fieldset id='MK0rJ'></fieldset></dl></div>
    2. <tfoot id='MK0rJ'></tfoot>
      <legend id='MK0rJ'><style id='MK0rJ'><dir id='MK0rJ'><q id='MK0rJ'></q></dir></style></legend>

    3. <small id='MK0rJ'></small><noframes id='MK0rJ'>

        <bdo id='MK0rJ'></bdo><ul id='MK0rJ'></ul>

        是什么导致“错过方法"?在这段代码中?

        What causes quot;Missed Methodquot; in this code?(是什么导致“错过方法?在这段代码中?)

          • <bdo id='0YYWG'></bdo><ul id='0YYWG'></ul>
            <i id='0YYWG'><tr id='0YYWG'><dt id='0YYWG'><q id='0YYWG'><span id='0YYWG'><b id='0YYWG'><form id='0YYWG'><ins id='0YYWG'></ins><ul id='0YYWG'></ul><sub id='0YYWG'></sub></form><legend id='0YYWG'></legend><bdo id='0YYWG'><pre id='0YYWG'><center id='0YYWG'></center></pre></bdo></b><th id='0YYWG'></th></span></q></dt></tr></i><div id='0YYWG'><tfoot id='0YYWG'></tfoot><dl id='0YYWG'><fieldset id='0YYWG'></fieldset></dl></div>
                  <tbody id='0YYWG'></tbody>

                <small id='0YYWG'></small><noframes id='0YYWG'>

                  <tfoot id='0YYWG'></tfoot>
                1. <legend id='0YYWG'><style id='0YYWG'><dir id='0YYWG'><q id='0YYWG'></q></dir></style></legend>
                  本文介绍了是什么导致“错过方法"?在这段代码中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如果这是一个完全不符合要求的问题,或者如果我没有提供足够的信息,请提前道歉 - 我对 iOS 开发(和 Objective-C)非常陌生,并且有跳跃的习惯进入深渊……

                  Apologies ahead of time if this is a completely off-the-mark question, or if I'm not including enough information - I'm very new to iOS development (and Objective-C), and have a habit of jumping into the deep end...

                  我在理解 GKTapper 示例代码中的 GameCenterManager.m 中的callDelegate"代码时遇到了麻烦,该代码也在此 tuts+ 教程中提供:http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-game-center-achievements-and-leaderboards-part-2/

                  I'm having trouble understanding the "callDelegate" code in GameCenterManager.m that's in the GKTapper Sample Code and also provided in this tuts+ tutorial: http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-game-center-achievements-and-leaderboards-part-2/

                  这是代码:

                  - (void) callDelegate: (SEL) selector withArg: (id) arg error: (NSError*) err
                  {
                      assert([NSThread isMainThread]);
                      if([delegate respondsToSelector: selector])
                      {
                          if(arg != NULL)
                          {
                              [delegate performSelector: selector withObject: arg withObject: err];
                          }
                          else
                          {
                              [delegate performSelector: selector withObject: err];
                          }
                      }
                      else
                      {
                          NSLog(@"Missed Method");
                      }
                  }
                  

                  我的应用程序总是记录错过的方法"行,但我不确定这个 callDelegate 代码实际上在做什么(所以我无法修复它).我认为最好的方法是了解这实际上在做什么,并获得比错过的方法"更好的输出......

                  My app always logs that "Missed Method" line, but I'm not sure what this callDelegate code is actually doing (so I can't fix it). I figure the best way forward is to learn what this is actually doing, and get better output than 'Missed Method'...

                  需要注意的是,我的应用目前正在沙盒模式下使用 Game Center,因为我仍在开发它.在这种情况下,可能会出现Missed Method"行——我也不确定.

                  One caveat is that my app is currently using Game Center in sandbox mode, since I'm still developing it. This 'Missed Method' line might be expected in this situation - I'm not sure of that, either.

                  有人能把这段代码翻译成段落形式吗?我特别不确定[delegate respondsToSelector: selector]"部分.

                  Would anybody be able to translate this code into paragraph form? I'm particularly unsure about the '[delegate respondsToSelector: selector]' piece.

                  或者,是否有人能够重写 NSLog 行,以便输出有关问题的更多/相关详细信息?我尝试了这个,希望看到哪个选择器没有正确通过respondsToSelector",但它似乎没有用:

                  Alternatively, would anybody be able to rewrite the NSLog line so that it outputs more/relevant detail about the problem? I tried this in the hopes of seeing which selector is not going through 'respondsToSelector' properly, but it didn't seem to work:

                  NSLog(@"Missed Method, %@", selector);
                  

                  推荐答案

                  查看到底发生了什么的最好方法是在 callDelegate 的开头放置一个断点,然后调试你的程序,而不是简单地运行它.可以按cmd-y调试.

                  T'he best way to see exactly what is happening is putting a breakpoint at the beginning of callDelegate and then debugging your program, instead of simply running it. You can debug by pressing cmd-y.

                  这样做,每次你的程序进入 callDelegate 函数时,它都会停止并弹出调试器窗口.在那里您将能够检查调用来自何处以及参数是什么.

                  Doing like this, each time your program enters the callDelegate function, it stops and the debugger window pops up. There you will be able to inspect where the call came from and what the parameters are.

                  至于对这个函数的简单描述,我会说它是一个辅助函数,它通过检查选择器的存在来包装对选择器的调用.您无需每次都检查并执行选择器,而是调用将为您完成这两件事的辅助函数.

                  As to a plain description of this function I would say that it is an helper function that wraps a call to a selector by preceding it with a check of existence of that selector. Instead of checking each time and the performing the selector, you call the helper function that will do both things for you.

                  所以,您总是看到日志行的原因是您要调用的函数不存在.通过使用调试器,您将能够看到它是哪个函数,哪个类缺少它,以及谁尝试了该操作.

                  So, the reason you always see the log line is that the function you would like to call is not there. By using the debugger you will be able to see which function it is, which class is missing it, and who attempted the operation.

                  这篇关于是什么导致“错过方法"?在这段代码中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  EAAccessory/EASession teardown during background(EAAccessory/EASession 在后台拆除)
                  Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                  ImageIO: lt;ERRORgt; JPEG Corrupt JPEG data: premature end of data segment iphone - how to catch this?(ImageIO:lt;错误gt;JPEG 损坏的 JPEG 数据:iphone 数据段过早结束 - 如何捕捉到这个?)
                  How to get indexPath.row of tableView which is currently being displayed?(如何获取当前正在显示的 tableView 的 indexPath.row?)
                  Xcode iOS organizer submit to app store yields quot;The archive is invalidquot; error(Xcode iOS 管理器提交到应用商店产生“存档无效;错误)
                  MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
                  • <legend id='Av2eq'><style id='Av2eq'><dir id='Av2eq'><q id='Av2eq'></q></dir></style></legend><tfoot id='Av2eq'></tfoot>
                        <bdo id='Av2eq'></bdo><ul id='Av2eq'></ul>
                          <tbody id='Av2eq'></tbody>
                          <i id='Av2eq'><tr id='Av2eq'><dt id='Av2eq'><q id='Av2eq'><span id='Av2eq'><b id='Av2eq'><form id='Av2eq'><ins id='Av2eq'></ins><ul id='Av2eq'></ul><sub id='Av2eq'></sub></form><legend id='Av2eq'></legend><bdo id='Av2eq'><pre id='Av2eq'><center id='Av2eq'></center></pre></bdo></b><th id='Av2eq'></th></span></q></dt></tr></i><div id='Av2eq'><tfoot id='Av2eq'></tfoot><dl id='Av2eq'><fieldset id='Av2eq'></fieldset></dl></div>

                          <small id='Av2eq'></small><noframes id='Av2eq'>