0

I have an app that makes multiple connections to different servers at the same time. I want to record each connection in an array so I can display them in a tableview and use them in a different section of my app. This is what I get back from GCDAsyncSocket.

{
address = "127.0.0.1";
hostname = "127.0.0.1";
port = 52509;
socket = "<a0471600 01000000>"; }

Trying to figure out how to parse this into a mutable array or dictionary based on the address so I can display it in a tableview. This is coming from GCDAsyncSocket

BlindingDawn
  • 274
  • 1
  • 4
  • 19

1 Answers1

2

I don't know where is problem. if i would like to store this data I created a class which has parameters address, hostname, port and socket as NSString objects. And next insert this object class to NSMutableArray.

Tomasz Szulc
  • 4,217
  • 4
  • 43
  • 79
  • I don't know if data coming from GCDAsyncSocket is NSDictionary or something because i don't know about it, but i would to make this: http://pastebin.com/AvubLbE6 – Tomasz Szulc Aug 30 '12 at 16:57
  • if data which coming to you is NSDictionary you must get it's element by use `dictionary objectForKey:@"address"` etc. – Tomasz Szulc Aug 30 '12 at 17:04
  • I follow that but how do I extract the values from a NSString that comes in like the above post into that array – BlindingDawn Aug 30 '12 at 17:10
  • you can use `rangeOfString` and `substractFromString: inRange` or something like that and substract all between " ". but for me this output is NSDictionary with multiple strings – Tomasz Szulc Aug 30 '12 at 17:24
  • My bad. the output is an NSDictionary. How can I work with it then? – BlindingDawn Aug 30 '12 at 17:51
  • i wrote it above. `string = [dictionary objectForKey:@"key"];` – Tomasz Szulc Aug 30 '12 at 17:54
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/16054/discussion-between-blindingdawn-and-tomasz-szulc) – BlindingDawn Aug 30 '12 at 18:00