문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top