The second object of each pair must not be zero

I am working on an application, and when I debug my code, it shows the following error.

-(IBAction)addSelected:(id)sender
{

    NSString* emptyStr = @"";

    NSDictionary* traits = [NSDictionary dictionaryWithObjectsAndKeys:
        self.walletName.text,       @"alias",
        self.abc.text,     @"abc",
        self.field.text,     @"field",
        @"name,"                @"Type",
        nil];-------at this point it is showing thread recieved signal sigabrt

This is the reason in the debugger. '+ [Dictionary NSDictionaryWithObjectsAndKeys:]: the second object of each pair must be non-zero. Or did you forget the nil-terminate parameter list? * Call stack on first throw:

+3
source share
3 answers

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

, is inside the line.

+6
source
 NSDictionary* traits = [NSDictionary dictionaryWithObjectsAndKeys:
        self.walletName.text,       @"alias",
        self.abc.text,     @"abc",
        self.field.text,     @"field",
        @"name",                @"Type", nil];

The problem is the @ "name" form.

+2
source

:

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 follows:

[NSNumber numberWithDouble:currentTime]

This solved my problems.

+1
source

All Articles