I'm tinkering around with a iPhone word app where I am using a DAWG structure for finding anagrams from a user defined word bank in real time as the user types. That part works well. As the words are identified, I want to retrieve specific information about each word which I currently have in a plist file (keyed by word). This informa...
I'm trying to store an NSArray object with a simple key (1,2,3 etc.) inside an NSDictionary. I'm pretty sure thats worked, but I'm not sure how to display the array data thats stored in there, I've got the following working (displaying a single array of data)
The test app i'm working on is a simple dictionary. Definition is the class i'...
[I have read the Cocoa memory management rules, but still want to be certain, and would like to know if this is good form.]
My class has a mutable dictionary ivar:
NSMutableDictionary *m_Dict;
...
m_Dict = [NSMutableDictionary dictionaryWithCapacity:10];
[m_Dict retain];
At some point I'll add a mutable array to the dictionary:
NS...
Been a tough week, will try to make this as clear as possible. Appreciate you taking the time to read.
Hi, I'm sending a registration request to a server. A user object in jSon is returned, I parse the jSon and save the jSon dictionary phone as a method on my User class. However, whenever I load the user from the phone - by reading the ...
Hi
I parse some JSON from a web service, this gives me an NSDictionary, I use this dictionary to populated properties on a valueEntity of type NSObject by
[myObject setValuesForKeysWithDictionary:JSONDict];
(myObject has the same property names and types as the dictionary from the JSON parser)
name = name
count = count
startDate = ...
Hello, i have the following code :
NSDictionary *dict =[[NSDictionary alloc]initWithObjectsAndKeys:myarray1,@"array1",myarray2,@"array2",nil];
NSArray *shorts=[[dict allKeys]sortedArrayUsingSelector:@selector(compare:)];
for(NSString *dir in shorts){
NSArray *tempArr=[dict objectForKey:dir];
for(NSString ...
I have a pList file:
Root - Dictionary
categories - Array
item 0 - Dictionary
item 1 - Dict
item 2 - Dict
I load the file like so:
-(void) loadCategories
{
// Loads the categories from the SymbolList.plist file
NSString *file = [[NSBundle mainBundle] pathForResource:@"SymbolList" ofType:@"plist"];
NSMutab...
In a code base I work with method valueForKey: is often used instead of objectForKey:. I have to optimize few methods that does this and was thinking if changing this to objectForKey: will introduce some performance gains?
...
Hi there
Is it possible to put in my NSDictionary into a NSInputStream?
This would be my NSDictionary
NSArray *keys = [NSArray arrayWithObjects:@"name", @"device_token", @"identifier", nil];
NSArray *values = [NSArray arrayWithObjects:@"Test iPhone", initDeviceToken, [UIDevice currentDevice].uniqueIdentifier, nil];
NSDictionary *parame...
I have an NSDictionary in which I use my own classes (NSObject subclasses) as keys and would like to make sure that I do not include the same key twice. However, because NSDictionary copies its keys, if I try to check whether an object is in the dictionary, it never thinks it is.
For example,
MyClass* obj = [[MyClass alloc] init];
NSMut...
Hello i am having problem in copying data from one NSDictionary to another i used the
[dicForFoodproduct_fromWeb initWithDictionary:dictforfoodproduct];
Here it terminates and says "unrecognized selecter sent to the instance..." I am getting 5 key values in dictForFoodProduct but am unable to copy that key values into dicForFoodProduc...
Hi there
basically I have an NSDictionary with keys and values.
The keys are all numbers, but at the moment they are strings.
I want to be able to compare them as numbers in order to sort them.
eg: If I have a Dictionary like this:
{
"100" => (id)object,
"20" => (id)object,
"10" => (id)object,
"1000" => (id)object,
}
...
Hi there
I have an NSDictionary. It has keys and objects.
For the purposes of simplicity the keys are Question numbers and the objects are calculated Answer scores.
Now how I did it before was that I set the answer score as the keys and the question numbers as the objects. This way I could get an array of allKeys from the dictionary, ...
Hi
I am building an add-on to my app where the user can search for an item in a list that is pre-populated with data from a .plist file. It is an NSDictionary. If the term, the user searched for, does not exist, the user can tap a + button and add it so it is there the next time.
First of I thought it would be as easy as using the NSUs...
I have a plist file which contains an array of dictionaries. Here is one of them:
Fred Dictionary
Name Fred
isMale [box is checked]
So now I am initializing my Person object with the dictionary I read from the plist file:
-(id) initWithDictionary: (NSDictionary *) dictionary {
if (self = [super init])
self.name =...
i want to save NSMutableArray or NSDictionary to save as file and close application.
then reopen application and read some data from that file to use.
is it possible?
...
I have a NSDictionary collection whose key is a unique id and value is an array with two different objects (FruitClass, ProductClass) and I would like to group the collection such that it's sorted first by ProductClass.productName and then by FruitClass.itemName.
So the final list would look something like:
{apple, butter}
{apple, pie...
I'm trying to store different data types in a NSDictionary to save in NSUserdefaults when the game terminates. I'm trying to store a char, 3 floats and a string, I keep getting a warning on the char and the floats and I cant seem to find the answer anywhere. 1)Do i even need to setup the arrays? 2) How do I store the different data types...
Hi, I am using TouchJSON to retrieve the JSON response from http://enbr.co.cc/TrailsApp/shops.php. In my app I use this code to handle a url scheme.
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
if (!url) {
return NO;
}
NSString *urlString = [url absoluteString];
NSString *urlStrin...
I would like to accomplish something like what is being done in this post: http://stackoverflow.com/q/538996/252428
however, i would like to construct an NSDictionary.
if i do something like:
constants.h
extern NSArray *const mFooKeys;
extern NSArray *const mFooObjects;
extern NSDictionary *const mFooDictionary;
constants.m
NSAr...