Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich one is the right method of initializing a NSMutableDictionary . Please anyone correct me here
    primarykey
    data
    text
    <p>I am trying to create a NSMutableDictionary in my class. I have read many post in stackoverflow to understand the difference. But now i am totally confused. So any one correct me , which one is the correct way of initialing a NSMutableDictionary in my class . I have to access this dictiionary in many areas of my application .So suggest me the good way of using the variable initialization ...</p> <pre><code>/// .h file @interface ActiveFeeds : NSObject { } @property (nonatomic, copy) NSMutableDictionary *invDictionary; @property (nonatomic, retain) NSString *filePath; @end @implementation ActiveFeeds @synthesize filePath; @synthesize invDictionary; - (id)init{ self = [super init]; if (self != nil){ NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:self.filePath]; self.invDictionary = [dictionary mutableCopy]; dictionary release]; } return self; } /* And use self.invDictionary all in the application */ - (void)setObjectAtKey:(NSMutableDictionary *)objectDic atKey:(NSString *)setKey{ [self.invDictionary setObject:objectDic forKey:setKey]; } - (void)dealloc { [self.invDictionary release]; [self.filePath release]; [super dealloc]; } @end </code></pre> <p>or like this ....</p> <pre><code>@interface ActiveFeeds : NSObject { NSMutableDictionary *invDictionary; NSString *filePath; } @end @implementation ActiveFeeds - (id)init{ self = [super init]; if (self != nil){ NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath]; invDictionary = [dictionary mutableCopy]; [dictionary release]; } } return self; } /* And use invDictionary all in the application */ - (void)setObjectAtKey:(NSMutableDictionary *)objectDic atKey:(NSString *)setKey{ [invDictionary setObject:objectDic forKey:setKey]; } - (void)dealloc { [invDictionary release]; [filePath release]; [super dealloc]; } @end </code></pre> <p>Please any one help me to get the correct way of using the variables ....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload