Code:
-(id<DemoHelloPrx>)createProxy
{
NSString* s;
int deliveryMode = [modePicker selectedRowInComponent:0];
if(deliveryMode == DeliveryModeTwowayAccessory || deliveryMode == DeliveryModeOnewayAccessory || deliveryMode == DeliveryModeOnewayAccessoryBatch)
{
s = @"hello:accessory -p com.zeroc.helloWorld";
}
else
{
s = @"hello"; // Use "hello" well-known proxy for the hello proxy.
}
NSString* locatorS = [NSString stringWithFormat:@"DemoIceGrid/Locator:tcp -h %@ -p 4061",
hostnameTextField.text, hostnameTextField.text, hostnameTextField.text];
[[NSUserDefaults standardUserDefaults] setObject:hostnameTextField.text forKey:hostnameKey];
ICEObjectPrx* prx = [communicator stringToProxy:s];
prx = [prx ice_locator:[ICELocatorPrx uncheckedCast:[communicator stringToProxy:locatorS]]];
switch(deliveryMode)
...
The code above specifies a locator proxy on the hello proxy. You could also define the Ice locator using the Ice.Default.Locator property.