Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

There is null in FBNCardHeroConfiguration in height in dictionary #48

Open
raheelsadiq opened this issue Jan 16, 2018 · 1 comment
Open

Comments

@raheelsadiq
Copy link

App is crashing at this point for finding Null here. See the attached image

crashreportfb

2018-01-16 12:56:58.790898+0500 APP[17245:1225043] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull doubleValue]: unrecognized selector sent to instance 0x1b215f650'

@raheelsadiq raheelsadiq changed the title There is null in FBNCardHeroConfiguration Null again height in dictionary There is null in FBNCardHeroConfiguration in height in dictionary Mar 5, 2018
@1um
Copy link

1um commented May 21, 2018

Fix this without modifying source by removing all keys with null value. In didReceiveRemoteNotification:

userInfo = [userInfo mutableCopy];
[userInfo removeNulls];

Recursive implementaion of removeNulls:

@implementation NSMutableDictionary (RemoveNulls)
- (void)removeNulls {
    NSNull *null = [NSNull null];
    for (id key in self.allKeys) {
        NSObject *value = self[key];
        if (value == null) {
            [self removeObjectForKey:key];
        } else if([value isKindOfClass:[NSDictionary class]]) {
            self[key] = [value mutableCopy];
            [self[key] removeNulls];
        }
    }
}
@end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants