Hi guys,
I have a variable which is declared as...
..in a .h file. Then, in one of my classes the value is set. When I try to access it from another class it does something odd. The value is set to 'keroack' in one class, then in the second class I set the navigation.title to its value and it looks as you would expect. Then, on the very next line I tried to use it to build up another string and got a string of numbers and other characters...
Also, when I look at the variable in the debugger it has changed from type NSString to type NSCFstring.
I could understand if it was consistent, but it sets the title to the correct string.
Does anyone know what might be causing this strange (ie. not expected by me but probably complete correct) behaviour? And how I can use the value in another string like...
Without getting an error like...
[NSPlaceholderString stringWithFormat:]: unrecognized selector sent to instance 0x512d50
Many thanks
Ade
I have a variable which is declared as...
Code:
extern NSString *savedUid;
..in a .h file. Then, in one of my classes the value is set. When I try to access it from another class it does something odd. The value is set to 'keroack' in one class, then in the second class I set the navigation.title to its value and it looks as you would expect. Then, on the very next line I tried to use it to build up another string and got a string of numbers and other characters...
Code:
// Works as expected, setting title to 'keroack'
self.navigationItem.title = savedUid;
// Prints a strange string to the console... '\240r\240\214'
printf("%s \n", savedUid);
Also, when I look at the variable in the debugger it has changed from type NSString to type NSCFstring.
I could understand if it was consistent, but it sets the title to the correct string.
Does anyone know what might be causing this strange (ie. not expected by me but probably complete correct) behaviour? And how I can use the value in another string like...
Code:
NSString * filter = [[NSString alloc] initWithString:(NSString *)savedUid];
Without getting an error like...
[NSPlaceholderString stringWithFormat:]: unrecognized selector sent to instance 0x512d50
Many thanks
Ade