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 Apr 30, 2009, 10:10 PM   #1
shikha123
macrumors newbie
 
Join Date: Apr 2009
TCP implementation

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.
shikha123 is offline   0 Reply With Quote
Old May 1, 2009, 12:35 AM   #2
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by shikha123 View Post
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.
__________________
dejo is offline   0 Reply With Quote
Old May 1, 2009, 12:45 AM   #3
shikha123
Thread Starter
macrumors newbie
 
Join Date: Apr 2009
Thanks a lot for your reply.So, what should I use instead of NSMutableArray?
shikha123 is offline   0 Reply With Quote
Old May 1, 2009, 01:50 AM   #4
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by shikha123 View Post
So, what should I use instead of NSMutableArray?
I don't know. All depends on what you are trying to do.
__________________
dejo is offline   0 Reply With Quote
Old May 1, 2009, 03:56 AM   #5
jnic
macrumors 6502a
 
Join Date: Oct 2008
Location: Cambridge
Quote:
Originally Posted by dejo View Post
NSMutableArray has neither a selectedObjects nor a lastObject method.
NSMutableArray inherits NSArray, so it will respond to lastObject.
jnic is offline   0 Reply With Quote
Old May 1, 2009, 10:49 AM   #6
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by jnic View Post
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.
__________________
dejo is offline   0 Reply With Quote
Old May 1, 2009, 12:38 PM   #7
shikha123
Thread Starter
macrumors newbie
 
Join Date: Apr 2009
So, what can be the reason of error? Sorry for being a bother.
shikha123 is offline   0 Reply With Quote
Old May 1, 2009, 01:09 PM   #8
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
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?
kainjow is offline   0 Reply With Quote
Old May 1, 2009, 01:17 PM   #9
shikha123
Thread Starter
macrumors newbie
 
Join Date: Apr 2009
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!
shikha123 is offline   0 Reply With Quote
Old May 1, 2009, 01:25 PM   #10
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by shikha123 View Post
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?
__________________
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
View TCP/IP Activity? ArtOfWarfare Mac Programming 5 Mar 9, 2014 04:36 AM
iPhone: TCP/IP over SMS (NOT SMS over TCP/IP)? N64 Jailbreaks and iOS Hacks 3 Jan 1, 2014 03:29 PM
Resolved: Mysterious TCP block? Let's Sekuhara! Mac Basics and Help 13 Dec 14, 2013 12:47 PM
TCP Block and Airdrop between 2 MBP SD-B Mac Applications and Mac App Store 2 Aug 11, 2013 08:20 PM
Amazon S3 Constant TCP polling Lunchb0x8 OS X 10.8 Mountain Lion 0 Oct 11, 2012 03:31 AM

Forum Jump

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

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

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