function returning released objects
<p>I have made a custom singleton class with an nsmutabledictionary as a property.I set and retrieve values in this class through two methods </p>

<pre><code>-(void)setObject:(id)object forKey:(NSString*)key
{
    if(!object||object==nil)
    {

        return;
    }
    [self.dict setObject:[object retain] forKey:key];   
}
</code></pre>

<p>and objectForKey</p>

<pre><code>-(id)objectForKey:(NSString*)key
{

    id obj=[self.dict objectForKey:key];
    return obj;
}
</code></pre>

<p>The reason i do this is that while i save and retrieving values from nsuserdefaults in iterative methods(10000 loops or higher) the code is much slower.Hence i built a class mimicing the functionality of  nsuserdefaults .  The problem is that sometimes the values returned from this class is already released.As a result the code crashes ,Is there any further validations we can make so that this class returns only non released objects</p>
