Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 30, 2010, 02:44 PM   #1
jschulbach
macrumors newbie
 
Join Date: Jun 2010
'may no respond to' warning

I've got a singleton class that I'm calling a method on and get the "'x' may not respond to 'y'" warning. The method works fine, the .h for the singleton class is imported at the top of my implementation file where I'm using it. When searching online I get a lot of people talking about the method being placed above the code where the method is called. In my case the method is in another file that is included at the top of the file where it is called. I also saw some suggestions about reordering the class file list but the singleton class is the first in my list so that shouldn't be the issue. What else might cause this warning?
jschulbach is offline   0 Reply With Quote
Old Jul 30, 2010, 03:03 PM   #2
jschulbach
Thread Starter
macrumors newbie
 
Join Date: Jun 2010
I figured it out. I'm using a class someone else wrote and the method that was being called wasn't declared in the .h for the singleton class. I'm pretty new so I didn't think to check for that. Are the methods not listed in the .h file generally methods intended to only be used within the class itself?
jschulbach is offline   0 Reply With Quote
Old Jul 30, 2010, 03:50 PM   #3
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by jschulbach View Post
Are the methods not listed in the .h file generally methods intended to only be used within the class itself?
Correct. And if they're not listed in the .h file, then they can only be called from within the class itself. You might also run into the "may not respond to" warning if the compiler has not seen the method defined before encountering a usage of it. Such a warning can be avoided by either moving the method definition before its first use or via the Objective-C version of private methods: creating a category on the class itself that declares the method.
__________________
dejo is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
WebView does not respond to scrollToPoint: Blakeasd Mac Programming 0 Dec 3, 2013 07:35 PM
Why does my 4G respond so slowly!? Drewski iPod touch 0 Dec 2, 2013 12:26 PM
Trackpad does not respond seamanator Mac Basics and Help 0 Oct 26, 2013 09:05 PM
Lockscreen won't respond? blasto2236 iOS 7 1 Jul 6, 2013 04:38 PM

Forum Jump

All times are GMT -5. The time now is 04:15 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC