arrayWithObjects: Objects should be NSStrings
iphone, objective-c, xcode
Solution
self.component1Data = [NSArray arrayWithObjects: string, string2, nil];
Assuming string and string2 are of type `NSString *`.
Problem
I used this code to file the rows in my UIPickerView: ``` self.component1Data = [NSArray arrayWithObjects: @"Sample", @"Sample1", @"...", nil]; ``` How can I get a NSString instead of the "sample"? I tried it with "%@" but it doesn't work: ``` self.component1Data = [NSArray arrayWithObjects: @"%@",string, @"%@",string2, @"...", nil]; ```