Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting: NSInvalidArgumentException: setObjectForKey: object cannot be nil #1

Closed
f8bar opened this issue May 31, 2013 · 1 comment
Closed

Comments

@f8bar
Copy link

f8bar commented May 31, 2013

Hi,

I'm trying to remove an Object via the removeEntryAtIndex function but i get a NSInvalidArgumentException on Line 1043 of your NSOrderedDictionary.m.
1043: [pairs setObject:nil forKey:key];

Fixed it via: [pairs setObject:[NSNull null] forKey:key];

Greets
f8bar

@Marxon13
Copy link
Owner

Marxon13 commented Jun 1, 2013

I have fixed the problem, I replaced [pairs setObject:nil forKey:key]; with [pairs removeObjectForKey:key];

Here is why I used removeObjectForKey: instead of setObject:forKey:
[pairs setObject:[NSNull null] forKey:key]; would seem to work, but it is not the same as actually removing the object. [NSNull null] is a placeholder for nil, but is not actually nil, so the key null pair will still exist in memory.

Please confirm that this fixes the problem, and if it does, please close the issue.

Thanks,
Brandon

@f8bar f8bar closed this as completed Jun 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants