title: Objective-C string arrays
body: <p>I have a string array as such:</p>
  
  <pre><code>NSArray *names;
  names = [NSArray arrayWithObjects:
  @"FirstList",
  @"SecondList",
  @"ThirdList",
    nil];     
  </code></pre>
  
  <p>I'm trying to assign an element of this string array to a string variable as such:</p>
  
  <pre><code>NSString *fileName = names[0]; // "Incompatible types in initialization"
  </code></pre>
  
  <p>or with casting</p>
  
  <pre><code>NSString *fileName = (NSString)names[0]; // "Conversion to non-scalar type requested"
  </code></pre>
  
  <p>I'm trying to do this, so I can use the string in a method that takes a string as an argument, such as: </p>
  
  <pre><code>NSString *plistPath = [bundle pathForResource:filetName ofType:@"plist"];
  </code></pre>
  
  <p>Is there no way to assign an element of a string array to a string variable?</p>
  
  <h3>Update from 2014: The code in this post actually would work these days since special syntactic support has been added to the framework and compiler for indexing NSArrays like <code>names[0]</code>. But at the time this question was asked, it gave the error mentioned in this question.</h3>