iPhone Loading an Image from a URL
<p>I am experiencing some issues when I load a UIImage from a URL into a UIImageView on the iPhone.  When I generate the NSURL (with the URL in the argument of NSURL's URLWithString method) using properties of an object, the image is not retrieved at all, however if I hardcode the same URL, the image is retrieved and displayed as expected.<br />
The [item valueForKey:@"pictureLocation"]; part below seems to be what is causing the problem because even when two hardcoded strings are concatenated, the NSURl is generated with no issues.  </p>

<pre><code>NSString * imagePath = @"http://localhost:3000";
NSString * specificPath = (NSString *)[item valueForKey:@"pictureLocation"] ; 
//concatenate the strings to get a fully formed URL
NSString * finalPath = [imagePath stringByAppendingString:specificPath]; 

UIImage *img = [[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString:finalPath]]] retain];
</code></pre>

<p>Essentially, when I NSLog the finalPath and instead hardcode that URL into the program, I get the expected result.  </p>

<p>Any ideas as to why this might be the case??</p>

<p>Thanks.</p>
