desu sai venkat
desu sai venkat

Reputation: 355

setValuesForKeysWithDictionary in NSMutableDictionary is Crashing

I have a method updateTraits in which I try to update the variable traits by using setValuesForKeysWithDictionary and during this, the crash is happening.

traits is defined as shown below:

@property (nonatomic, readwrite) NSMutableDictionary<NSString*, NSObject*>* traits;

UpdateTraits is defined as shown below:

    - (void)updateTraits:(RSTraits *)traits {
    if(traits == nil) {
        traits = [[RSTraits alloc] init];
        traits.anonymousId = [preferenceManager getAnonymousId];
        [_traits removeAllObjects];
    }
     // crash is happening on this line here
    [_traits setValuesForKeysWithDictionary:[traits dict]];
   }

Note: I am trying to call the updateTraits method from a background thread.

Can anyone point out what exactly I am doing wrong? Thanks in Advance.

Crash message: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

Crash Description

Upvotes: 1

Views: 99

Answers (0)

Related Questions