views:

85

answers:

3

I am having code

NSString *cellValue1 = [products1 objectAtIndex:indexPath.row];

when i try to print NSLog(@"cell value is %@",cellValue1);

in log i am not getting anything, if i use %s, i am getting some symbols, not the string located in cellValue1.

Please help me.

Thanks in advance.

A: 

Check to make sure that products1 is actually set. It sounds as though it's nil when you send it the -objectAtIndex: message.

jlehr
No, NSLog display '(null)' when you try to log a nil value as an object.
Macmade
The questioner didn't specify that they *weren't* seeing (null) (their interpretation of seeing null may lead them to say they aren't getting anything, since null technically translates to mean nothing.)... Just my two cents.
Jasarien
lol that's right ; )
Macmade
Thanks jlehr, above answer solved my problem, problem was products1 was not actually set.
mac
@mac Then you should accept the correct answer.
Nikolai Ruhe
+1  A: 

It surely means your string is empty... Check it with the length method...

Macmade
A: 
Newbyman
-1 Never use non-literals as format strings.
Nikolai Ruhe
@ Nikolai, The sample code was supplied to help the user "Run-Down" a possible solution for the problem by making sure that that he was getting an actual string. Thanks for the downgrade point!
Newbyman