• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Help with "Messages without a matching method signature..." issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with "Messages without a matching method signature..." issue


  • Subject: Help with "Messages without a matching method signature..." issue
  • From: Brad Gibbs <email@hidden>
  • Date: Tue, 22 Jul 2008 12:28:46 -0700

I read the Newbie Question on a method signature thread from June 4 a few times, but, either that isn't the problem I'm having, or I'm not understanding the solution...

Any help would be greatly appreciated.


On compile, I get the following warnings:

warning: 'Class2' may not respond to '+sendMSG:toPort:'
warning: (Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.




And clicking a button produces the following in the Console:

2008-07-22 11:03:06.824 OSX Interface[37304:10b] *** +[Class2 sendMSG:toPort:]: unrecognized selector sent to class 0x4080



Below is the offending code:

Class 1 - This class provides IBActions, each of which calls the sendMSG: toPort: method of Class 2. The arguments for the methods in this class are used to construct NSStrings in Class 2.
Class 2 - The arguments sent from a button in Class 1 provide two strings, which are used to compose a new NSString, which is sent to another device on the network.



@interface Class1 : NSObject { } - (IBAction)powerOn:(id)sender;


@implementation Class1

- (IBAction)powerOn:(id)sender {
	[Class2 sendMSG:@"P1P1" toPort:@"1"];


@interface Class2 : NSObject { }

- (NSString *)sendString:(NSString *)stringToSend;
- (void)sendMSG:(NSString *)string toPort:(NSString *)port;

@implementation Class2

- (NSString *)sendString:(NSString *)stringToSend {
NSData *postData = [stringToSend dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

NSMutableURLRequest *theRequest=[[[NSMutableURLRequest alloc] init] autorelease];
...

response = [[NSString alloc] initWithData:receivedData encoding:NSASCIIStringEncoding];
return response;
}



- (void)sendMSG:(NSString *)string toPort:(NSString *)port {
NSString *stringToSend;
stringToSend = [[NSString alloc] initWithFormat:@"method=MSGSend&param1=%@&param2=%@&param3=200", port, string];
NSLog(@"String being sent: %@", stringToSend);
[self sendString:stringToSend];
}
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Help with "Messages without a matching method signature..." issue
      • From: Charles Steinman <email@hidden>
    • Re: Help with "Messages without a matching method signature..." issue
      • From: Steve Bird <email@hidden>
  • Prev by Date: NSPredicateEditorRowTemplate and ANY predicate
  • Next by Date: Re: Help with "Messages without a matching method signature..." issue
  • Previous by thread: Re: NSPredicateEditorRowTemplate and ANY predicate
  • Next by thread: Re: Help with "Messages without a matching method signature..." issue
  • Index(es):
    • Date
    • Thread