ios - Why is [NSNull null] value not added to NSDictionary? -


i creating nsdictionary using code below, , expecting have key @"originalmessageid" contain [nsnull null] when originalmessageid.intvalue == -1.

but logger writetologfile method gives following output:

2014-04-07 19:16:52: json params: {     addressid = 1; } 

i've stripped code down trying add 2 keys, , still it's not adding originalmessageid key.

where going wrong?

p.s. code fails when load app distribution build, seems work when load app development build.

nsdictionary *jsondict;  sourcephonenumber *sourcephonenumber = [databaseinterface fetchdefaultsourcenumber];  [logger writetologfile:[nsstring stringwithformat:@"sourcephonenumber = %@", sourcephonenumber]];  if (originalmessageid.intvalue == -1) {     //nsstring *uuidstring = [[nsuuid uuid] uuidstring];      jsondict = [[nsdictionary alloc] initwithobjectsandkeys:                 [nsnumber numberwithunsignedlonglong:1], @"addressid", /* should sourcephonenumber.addressid */                 //messagebody, @"messagebody",                 //contacts, @"contacts",                 //uuidstring, @"clientid",                 [nsnull null], @"originalmessageid",                 nil]; } else {     jsondict = [[nsdictionary alloc] initwithobjectsandkeys:                 [nsnumber numberwithunsignedlonglong:1], @"addressid", /* should sourcephonenumber.addressid */                 originalmessageid, @"originalmessageid",                 messagebody, @"messagebody",                 contacts, @"contacts",                 nil]; }  [logger writetologfile:[nsstring stringwithformat:@"json params: %@", jsondict]]; 

the output seeing happen if originalmessageid nil. cause if condition fail going else part. , if `originalmessageid nil, nil terminates creation of dictionary @ point leaving addressid key , value.

so need determine why originalmessageid nil.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -