TCP implementation

Discussion in 'iPhone/iPad Programming' started by shikha123, Apr 30, 2009.

  1. macrumors newbie

    Joined:
    Apr 21, 2009
    #1
    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.
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    NSMutableArray has neither a selectedObjects nor a lastObject method.
     
  3. thread starter macrumors newbie

    Joined:
    Apr 21, 2009
    #3
    Thanks a lot for your reply.So, what should I use instead of NSMutableArray?
     
  4. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    I don't know. All depends on what you are trying to do.
     
  5. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #5
    NSMutableArray inherits NSArray, so it will respond to lastObject.
     
  6. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    Oops. I had checked the NSArray class reference for both those methods but I guess I missed that one.
     
  7. thread starter macrumors newbie

    Joined:
    Apr 21, 2009
    #7
    So, what can be the reason of error? Sorry for being a bother.
     
  8. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #8
    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?
     
  9. thread starter macrumors newbie

    Joined:
    Apr 21, 2009
    #9
    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!
     
  10. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #10
    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?
     

Share This Page