All posts for the month October, 2014

The following code will deselect the index of an NSArrayController leaving the controller without a selected index. This works well when observing key value “selectedIndex” of NSArrayController when the user is selecting in two different arrays and a reset of the indexes is required to get an observation notice.

NSIndexSet *indexEmptySet= [NSIndexSet indexSet];
NSLog(@”manual switching”);
if (manual) {

//NSArrayController 1
[boxList setSelectionIndexes: indexEmptySet];

//NSArrayController 2

[DeviceArrayController setSelectionIndexes: indexEmptySet];


In order for AsyncSocket to get notification of a disconnect it needs to have an outstanding read. [socket readDataWithTimeout:-1 tag:0] is only good for 1 read. To have an outstanding read put [socket readDataWithTimeout:-1 tag:0] -didWriteData delegate. When remote disconnects a message is sent through the asynchSocket delegate -willDisconnectWithError. At which point the appropriate code can be used here to deal with disconnect.