Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 30, 2010, 01: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, 02: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, 02: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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
iWeb no responding BLOND37 Mac Applications and Mac App Store 1 Oct 18, 2011 11:09 AM
meddling with the responder chain MrFusion Mac Programming 5 May 14, 2011 06:06 PM
OMG! - Most of my Mac Applications are not responding xDeathReaperx Mac Applications and Mac App Store 11 Jan 13, 2011 11:03 PM
kernal warning macbook pro reblevitan MacBook Pro 4 Dec 3, 2010 05:38 PM
NO 10% power warning on OS 3.0?? Raphy iPhone 6 Jun 11, 2009 02:22 AM


All times are GMT -5. The time now is 08:08 PM.

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

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