{"id":3887,"date":"2014-03-30T06:11:00","date_gmt":"2014-03-30T06:11:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/in-objective-c-is-there-a-way-to-specify-which-definition-of-a-selector-you-want-selector-to-use-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:11:00","modified_gmt":"2014-03-30T06:11:00","slug":"in-objective-c-is-there-a-way-to-specify-which-definition-of-a-selector-you-want-selector-to-use-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/in-objective-c-is-there-a-way-to-specify-which-definition-of-a-selector-you-want-selector-to-use-collection-of-common-programming-errors\/","title":{"rendered":"In Objective-C, is there a way to specify which definition of a selector you want @selector() to use?-Collection of common programming errors"},"content":{"rendered":"<p>Xcode 4 is giving me (rather unhelpful) errors about &#8220;unimplemented selector &#8216;xxx'&#8221; when I try to use @selector(xxx) with any method not actually defined in the same source file. The error goes away (at least for the project build) if I set the LLVM compiler warning, &#8220;Multiple Definition Types for Selector&#8221; to &#8220;No&#8221;. (This is the iOS default, but for my project it had been enabled.) <strike>However, even with this off, the error still shows up in the editor if &#8220;Enable live issues&#8221; is checked in the Build Settings dialog.<\/strike><\/p>\n<p>So now I&#8217;ve turned off live issues so as not to be distracted, which is a bit of a let down. My question is: Is there a way I can get rid of the error by, perhaps, specifying which definition of a selector I want to use? Or should it even matter, i.e. do all definitions of a method share the same selector in Objective-C? Is this a compiler bug, or perhaps a bogus setting that I should just leave off? <strike>(And if the latter, why is it on for the live build feature in the new editor?)<\/strike><\/p>\n<p>Here&#8217;s the code, just to be clear:<\/p>\n<pre><code>if ([recognizer respondsToSelector:@selector(translationInView:)]) {\n...\n}\n<\/code><\/pre>\n<p>And here&#8217;s the error:<\/p>\n<pre><code>error: unimplemented selector 'translationInView:' [-Wselector,2]\n     if ([recognizer respondsToSelector:@selector(translationInView:)]) {\n                                         ^\n<\/code><\/pre>\n<p>If I replace &#8216;translationInView:&#8217; with a method defined in the same source file, there&#8217;s no error. I&#8217;ve imported the header which defines this method, and I&#8217;ve tried declaring the method in a category within this source file. Doesn&#8217;t matter.<\/p>\n<p>I&#8217;m leaving the warning off and live builds off and moving on for now, but I&#8217;d love to find a better resolution for this issue. At the very least, I&#8217;d like to learn whether Objective-C&#8217;s @selector has a syntax for selecting a particular definition of a method, since I have not found any sign of this anywhere so far.<\/p>\n<p>Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Xcode 4 is giving me (rather unhelpful) errors about &#8220;unimplemented selector &#8216;xxx&#8217;&#8221; when I try to use @selector(xxx) with any method not actually defined in the same source file. The error goes away (at least for the project build) if I set the LLVM compiler warning, &#8220;Multiple Definition Types for Selector&#8221; to &#8220;No&#8221;. (This is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3887","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3887"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3887\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}