SDWebImage setImageWithURL iOS8 crash

I have successfully used SDWebImage. But with iOS8 its crashes when we set the image ie

[ myImageView setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",@"url"]] placeholderImage:[UIImage imageNamed:PROFILE_HOLDER_IMAGE]]; 

Is there any way to avoid this

Greetings

+6
source share
3 answers

They changed setImageWithURL to sd_setImageWithURL for iOS 8.

Try this new syntax,

 [myImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",@"url"]] placeholderImage:[UIImage imageNamed:PROFILE_HOLDER_IMAGE]]; 
+12
source

First of all, setImageWithURL:placeholderImage: deprecated, you should also check if your string is a non-null URL. Try this approach:

  NSString *imageURLString; if (imageURLString && ![imageURLString isEqual:[NSNull null]]) { NSURL *imageURL = [NSURL URLWithString:imageURLString]; [myImageView sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; } 

Also make sure you are using the latest version of SDWebImage.

+1
source

Some problems arise when using SDWebImage with iOS8 along with a crash even when upgrading to the latest version 3.7.1. The quick fix I found is to add libPods-SDWebImage.a to the list of related project binaries (select your project’s goal> Phase Assemblies> Link with binary libraries> click "+" and add libPods-SDWebImage.a ).

This fix is ​​for cocoapods users.

+1
source

Source: https://habr.com/ru/post/975295/


All Articles