Muju Muju - 2 months ago 8
iOS Question

Why I am Getting value of NSString like 0xb000000000000033 in Objective C

I am new to

iOS
and I have written code like this

NSString *Mobilenumber =[firstObj valueForKey:@"MobilNo"];
NSLog(@"Mobile Number is =%@",Mobilenumber);
NSString *Employeeid=[firstObj valueForKey:@"EmpId"];
NSLog(@"Employee ID is =%@",Employeeid);


Mobile Number gives me correct value while
Employeeid
give me value like this 0xb000000000000033. But when I
NSLog
the Employeeid it shows value as 3.

But when I compair it with the value of another text

if ([EmployeeStr isEqual:techString])


it doesn't go to
if
condition but both the string contain the same value. How to solve this type of value 0xb000000000000033.

Answer

// i think you getting NSNumber object for that key "EmpId" just try like this, i hope it will work for you.

 NSString *Employeeid = [NSString stringWithFormat:@"%@", [firstObj valueForKey:@"EmpId"]]