PDA

View Full Version : TCP implementation




shikha123
Apr 30, 2009, 10:10 PM
Hi! I am developing a TCP application with an iphone as a client and the MAC as a server. I am having a problem with an object of type NSMutableArray where I am getting a warning:
'NSMutableArray may not respond to '-selectedObjects'

My code line is:
NSNetService *remoteService=[[servicesController selectedObjects]lastObject];

Would appreciate some help for this.



dejo
May 1, 2009, 12:35 AM
I am having a problem with an object of type NSMutableArray where I am getting a warning:
'NSMutableArray may not respond to '-selectedObjects'

My code line is:
NSNetService *remoteService=[[servicesController selectedObjects]lastObject];
NSMutableArray has neither a selectedObjects nor a lastObject method.

shikha123
May 1, 2009, 12:45 AM
Thanks a lot for your reply.So, what should I use instead of NSMutableArray?

dejo
May 1, 2009, 01:50 AM
So, what should I use instead of NSMutableArray?
I don't know. All depends on what you are trying to do.

jnic
May 1, 2009, 03:56 AM
NSMutableArray has neither a selectedObjects nor a lastObject method.

NSMutableArray inherits NSArray, so it will respond to lastObject.

dejo
May 1, 2009, 10:49 AM
NSMutableArray inherits NSArray, so it will respond to lastObject.
Oops. I had checked the NSArray class reference for both those methods but I guess I missed that one.

shikha123
May 1, 2009, 12:38 PM
So, what can be the reason of error? Sorry for being a bother.

kainjow
May 1, 2009, 01:09 PM
Well you're calling selectedObjects on servicesController but servicesController doesn't know that method. What is servicesController declared as? What are you trying to do?

shikha123
May 1, 2009, 01:17 PM
servicesController is an NSArray.It is used to store the names of the servers found on the local network. Actually, in my program the iphone is the client which sends the information to MAC which acts as a server. Both are on a Wifi network

Thanks!

dejo
May 1, 2009, 01:25 PM
servicesController is an NSArray.It is used to store the names of the servers found on the local network. Actually, in my program the iphone is the client which sends the information to MAC which acts as a server. Both are on a Wifi network
NSArray has no selectedObjects method.

And the rest of that post is more an explanation of what you have and not really what you are trying to do. For example, why do you think you need to call selectedObjects? What is the purpose of that?