Second object of each pair must be non-nil

后端 未结 3 855
轮回少年
轮回少年 2021-01-21 12:17

Iam working on app and when i debug my code it is showing the following error.

-(IBAction)addSelected:(id)sender
{

    NSString* emptyStr = @\"\";

    NSDictio         


        
相关标签:
3条回答
  • 2021-01-21 12:26
     NSDictionary* traits = [NSDictionary dictionaryWithObjectsAndKeys:
            self.walletName.text,       @"alias",
            self.abc.text,     @"abc",
            self.field.text,     @"field",
            @"name",                @"Type", nil];
    

    The problem is form @"name,".

    0 讨论(0)
  • 2021-01-21 12:34

    @"name," @"Type", should be @"name", @"Type",

    The , is inside the string.

    0 讨论(0)
  • 2021-01-21 12:43

    In my case i was doing this:

    NSDate *today = [NSDate date];
        NSTimeInterval currentTime = [today timeIntervalSince1970];
    
        NSMutableDictionary *dictExpiryDate =
        [NSMutableDictionary dictionaryWithObjectsAndKeys:currentTime, KEY_4_VALUE_OF_EXPIRY_DATE, nil];
    

    The problem here is currentTime, i replaced currentTime as followed:

    [NSNumber numberWithDouble:currentTime]
    

    This solved my issues.

    0 讨论(0)
提交回复
热议问题