I am new to Objective-C and as a very simple learning exercise, I have created a method to return the first initial of a variable storing a name:
-(NSString *)initial
{
return [_name substringToIndex:1];
}
This works exactly as intended when I use substringToIndex, however if I instead use characterAtIndex I receive a EXC_BAD_ACCESS error.
Can anyone explain why one works and the other doesn’t?
characterAtIndex returns a char, not a (NSString *), probably the problem is in returning the wrong type.