incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: dictionary or array
Date Wed, 18 Sep 2013 19:03:09 GMT

On Sep 18, 2013, at 11:48 AM, Rana Bunnni <rana_ios@yahoo.se> wrote:

> I don't understand when i get the response from web service like (CouchDB) , the response
is array or dictionary ?
> If  was an array how can i get the information from it ? 
> And 
> If  was a  dictionary  how can i get the information from it ? 

These aren’t CouchDB questions, they’re general Cocoa questions. Sounds like you should
read documentation on NSArray and NSDictionary, or get a good book on iOS or Mac development.
This is kind of off-topic for this list. Apple’s cocoa-dev mailing list (http://lists.apple.com)
is a better place, *if* you’ve read through docs and still have issues.

You get items from an array using [array objectAtIndex:], and from a dictionary using [dict
objectForKey:].
(Actually in Xcode 4.6 or later you can access them as in JavaScript/Python/Ruby/etc., simply
as “array[index]” or “dict[key]”.)
Iteration looks like "for (id item in arrayOrDict) { … }"
Iterating a dictionary gives you the keys, so you’ll need to look those up as above to get
the corresponding values.

—Jens
Mime
View raw message