First of all, I tried almost all the solutions given in stackoverflow but I didn\'t succeed in implement global vars, I even did a step by step tutorial and still I get the
The error has nothing to do with global variables. The error message
-[__NSArrayM length]: unrecognized selector sent to instance 0x8b7fbc0
indicates that you somewhere in your code assigned a NSMutableArray
to farmerCardNumber
instead of a NSString
.
For example, if you do something like
farmerCardNumber = [someDictionary objectForKey:@"someKey"];
and [someDictionary objectForKey:@"someKey"]
happens to be an array and not a string,
then farmerCardNumber
points to that array, even if it was declared as pointer to
a string.