Ice Touch for Objective-C

Ice Touch for Objective-C is ZeroC's distributed computing platform for the iPhone, iPad, iPod touch, and OS X. It extends the power of Ice to Apple's mobile devices and enables you to seamlessly integrate your mobile applications with your corporate infrastructure.

Productivity

The Ice language mapping for Objective-C is simple and elegant and nicely integrates with the Cocoa framework. For example, a Slice dictionary is mapped to a Cocoa NSDictionary, so you are already familiar with how to use it. After maybe half an hour of browsing the manual, you'll be up and running, especially if you have experience with Ice for other programming languages.

Applications targeted for Mac OS X and Cocoa can take advantage of Objective-C's garbage collection, so explicit memory management is necessary only for applications that run on iOS devices.

Portability

Ice Touch provides SDKs that allow you to target an application for Mac OS X, Cocoa, the iOS simulator, and iOS devices such as the iPhone, iPad, and iPod touch. This makes it easy to test iOS applications before deploying them on an actual device. By targeting test clients and servers for Mac OS X, you can create unit and integration tests that use the command line and, therefore, can easily be incorporated into existing test frameworks.

Sample Code

To illustrate how Ice is used with Objective-C, consider the following Slice interface definitions:

module Biz {
    struct Item {
        string sku;
        int qty;
    };
    sequence<Item> ItemSeq;
     
    interface Invoice {
        void addItems(ItemSeq items);
        void submit();
    };
    interface InvoiceFactory {
        Invoice* create();
    };
};

Objective-C code that creates an invoice using the factory is shown below:

// Create a proxy for the invoice factory object.
id<ICEObjectPrx> proxy = [communicator stringToProxy:@"InvoiceFactory:tcp -p 9000"];

// Narrow the proxy to the proper type.
id<BIZInvoiceFactoryPrx> factory = [BIZInvoiceFactoryPrx checkedCast:proxy];

// Use the factory to obtain a proxy for a new invoice object.
id<BIZInvoicePrx> invoice = [factory create];

// Add items to the invoice.
BIZItem *item = [BIZItem item];
item.sku = @"10-6139";
item.qty = 3;
[invoice addItems:[NSArray arrayWithObjects:item, nil]]; // Submit the invoice. [invoice submit];
Terms of Use | Privacy © 2011 ZeroC, Inc.