I'm having trouble with this method, more specifically I'm having trouble with my logic. I'm trying to combine two array's firstName and lastName both sequentially matching up. I was thinking I could us a for loop to iterate through the array count and then combine the array's using arrayByAddingObjectsFromArray.
Unfortunately it seems that this part throws up an error : __NSCFConstantString arrayByAddingObjectsFromArray:]: unrecognized selector sent to instance 0x10c824218
Any ideas why this is? What does it mean by selector; is that it doesn't like the array i'm trying to pass to it?
- (NSString *)badgeForSpeaker:(NSString *)speaker{ NSArray *firstName = @[@"Adele", @"Edsger", @"Joan", @"Clarence", @"Margaret", @"George", @"Tim", @"Jean"]; NSArray *lastName = @[@"Goldberg",@"Dijkstra",@"Clarke",@"Ellis",@"Hamilton",@"Boole",@"Berners-Lee",@"Bartik"]; NSString *uppercaseString = [speaker copy]; NSMutableString *hello = [[NSMutableString alloc]init]; for (NSUInteger i =0; i < [lastName count] ; i++) { uppercaseString = [lastName[i] capitalizedString]; hello = [@"Hello, my name is " mutableCopy]; firstName = [firstName[i] arrayByAddingObjectsFromArray:lastName[i]]; NSString *fullNameString = [firstName componentsJoinedByString:@" "]; [hello appendFormat:@"%@",fullNameString]; NSLog(@"%@",hello); } return hello; }