I am doing a very simple NSArray search as follows
BOOL isCashTender = [_tenderRows containsObject: @"Cash"];
A debug output of the array tells me there is an object in there "Cash" as seen below (its the second to last one)
2017-04-07 11:20:27.644551 NWMobileTill[2134:701297] tenderRowsarray:(
"<Tender: 0x17009c2a0> (entity: Tender; id: 0xd0000000002c0004 <x-coredata://BE2CD993-FDED-43CE-99A3-88597A0E8046/Tender/p11> ; data: {\n amount = 10;\n authCode = nil;\n brandId = XX;\n cardEntryMode = nil;\n cardType = nil;\n createdDate = \"2017-04-07T11:20:22+08:00\";\n createdDateUtc = \"2017-04-07T03:20:22\";\n currency = EUR;\n extRefNo = \"Cash-In-EUR\";\n hashedPan = nil;\n inOrOut = IN;\n isSynched = 0;\n obfPan = nil;\n orderNumber = \"1-20170407112015\";\n status = 95;\n synchDate = nil;\n synchDateUtc = nil;\n tillId = 1;\n type = Cash;\n userName = a;\n})"
)
But when I look at the debug output of my BOOL it returns 0 when I expected it to be 1, why is that?
2017-04-07 11:20:27.644139 NWMobileTill[2134:701297] isCashTender = 0
tenderRows
contains just one object, and it isn't a string "Cash"
; it's a Tender entity.
That Tender entity may have a type
attribute whose value is "Cash"
, but that is not the question you asked (with containsObject:
).