1

I have an assets library url to a photo: "assets-library://asset/asset.JPG?id=8D4D7820-EDD6-4CA4-A44A-2ACD53A112FC&ext=JPG" I have this in a string property imgURLString. I am trying to convert this to NSURL in the following way:

NSURL *imageURL = [NSURL URLWithString:self.imgURLString];

However, I am getting an exception:

[NSURL length]: unrecognized selector sent to instance 0xa8281f0

I am sure I have the above mentioned string in self.imgURLString and it is not trying to convert an empty string. So why am I getting this exception and how do I solve it?

I am basically trying to convert the string to an NSURL to fetch the photo using the assets library url.

Mike Abdullah
  • 14,933
  • 2
  • 50
  • 75
rkk817
  • 117
  • 1
  • 13

1 Answers1

0

Your self.imgURLString is actually already an NSURL, not an NSString. You are assigning the asset URL (an NSURL) to your NSString property. Change your property to be an NSURL.

rmaddy
  • 314,917
  • 42
  • 532
  • 579