no visible @interface for UIImageView declares the selector sd_setShowActivityIndicatorView and sd_setIndicatorStyle is not detected
Asked Answered
A

5

7

It is very strange that sd_setImageWithURL is working but got an error in sd_setShowActivityIndicatorView:YES and sd_setIndicatorStyle.

Below what I have done.

[cell.cellImgView sd_setShowActivityIndicatorView:YES];
[cell.cellImgView sd_setIndicatorStyle:UIActivityIndicatorViewStyleGray];

[cell.cellImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://img.youtube.com/vi/%@/hqdefault.jpg",[[[galleryDic objectForKey:@"data"] valueForKey:@"Video_id"] objectAtIndex:indexPath.row]]] placeholderImage:[UIImage imageNamed:@"youtube-video"] ];

Please see the image below: enter image description here

Aminopyrine answered 1/6, 2017 at 8:33 Comment(0)
A
11

I figured it out now, Well I have to import #import "UIView+WebCache.h" too along with others then i have used following:

[cell.cellImgView sd_setShowActivityIndicatorView:YES];
[cell.cellImgView sd_setShowActivityIndicatorView:UIActivityIndicatorViewStyleGray];

Also, I removed the SDWebImage folder, what i used to integrate manually, then I have installed it through `POD' again, and now it is working as i wanted.

Aminopyrine answered 1/6, 2017 at 10:19 Comment(0)
B
8

For anybody who has this issue in 2019

sd_setShowActivityIndicatorView has been removed in SDWebImage v5

Use this instead

imageView1.sd_imageIndicator = SDWebImageActivityIndicator.gray
//or
imageView2.sd_imageIndicator = SDWebImageProgressIndicator.`default`
//or
imageView2.sd_imageIndicator = SDWebImageActivityIndicator.medium //large, small, gray ...
Broke answered 22/9, 2019 at 5:50 Comment(0)
C
6

I migrate to version 4.0.

and

#import <SDWebImage/UIView+WebCache.h>
Cuneo answered 13/7, 2017 at 4:25 Comment(0)
N
2

There is no such method like sd_setShowActivityIndicatorView and sd_setIndicatorStyle in SDWebImage>UIImageView+WebCache.h that's why it shows no visible @interface for UIImageView declares the selector sd_setShowActivityIndicatorView and sd_setIndicatorStyle is not detected

Instead of that use following.

 [cell.cellImgView setShowActivityIndicatorView:YES]; 
 [cell.cellImgView setIndicatorStyle:UIActivityIndicatorViewStyleGray];

Here are these methods in UIImageView+WebCache.h

/**
 *  Show activity UIActivityIndicatorView
 */
- (void)setShowActivityIndicatorView:(BOOL)show;

/**
 *  set desired UIActivityIndicatorViewStyle
 *
 *  @param style The style of the UIActivityIndicatorView
 */
- (void)setIndicatorStyle:(UIActivityIndicatorViewStyle)style;
Novellanovello answered 1/6, 2017 at 9:57 Comment(4)
what is the difference from my code ?? I copied and pasted your code then realized it is same, and throwing the same error.Aminopyrine
[cell.cellImgView sd_setShowActivityIndicatorView:YES]; [cell.cellImgView sd_setIndicatorStyle:UIActivityIndicatorViewStyleGray]; And and answer [cell.cellImgView setShowActivityIndicatorView:YES]; [cell.cellImgView setIndicatorStyle:UIActivityIndicatorViewStyleGray]; both are same ?Novellanovello
No, My mistake, did that and now it can mapped to UIImageView+WebCache.h class, if I press cmd and on method name, but error is not going, i cleaned several times but during build errors come again.Aminopyrine
This methods are in #import "UIView+WebCache.h" by importing such file in my desired class and installing the sdwebimage by pods, its started working. Thanks anyway, I appreciate your time for me.Aminopyrine
U
1

Import following file

#import "UIImageView+WebCache.h"

#import "UIImageView+UIActivityIndicatorForSDWebImage.h"
Unroll answered 1/6, 2017 at 8:35 Comment(15)
or import another UIIMageVIew category file which are consists this method.Unroll
how to do that?Aminopyrine
try to import UIImageView+UIActivityIndicatorForSDWebImage.h file ....if exist in your projectUnroll
is this file exist in your project : "UIImageView+WebCache.h" ?Unroll
No there is no such file, but i downloaded it from this link github.com/JJSaccolo/UIActivityIndicator-for-SDWebImage and integrated, then did #import "UIImageView+UIActivityIndicatorForSDWebImage.h" though it is not working. And yes UIImageView+WebCache.h this file is available ..Aminopyrine
then it will working this file because this method declared on this class.Unroll
then import this file UIImageView+UIActivityIndicatorForSDWebImage.hUnroll
Look these all files are there ibb.co/eRVK8F and I'm using it in pods, and from this link github.com/rs/SDWebImage , i got the idea to attach such indicator.Aminopyrine
#import <UIActivityIndicator-for-SDWebImage/UIImageView+UIActivityIndicatorForSDWebImage.h> This throwing error , despite that, #import "UIImageView+UIActivityIndicatorForSDWebImage.h" it is not throwing error.Aminopyrine
yes it is but i mentioned because user can understand this spUnroll
I uninstall it from pod and manually dragged and dropped it into the project, everything seems is okay but same result for that sd_setShowActivityIndicatorView and sd_setIndicatorStyle :/Aminopyrine
try to clean project .Unroll
@Unroll sd_setImageWithURL is accessed that means there is nothing wrong with importing the SDWebImageNovellanovello
I figured it out @KKRocks, By importing #import "UIView+WebCache.h" and installing SDWebImage in pods, it started working. Gone those errors. Thanks for your time, I appreciate you for helping me in so many ways. And please upvote my answer it is working now.Aminopyrine
@Unroll I did.. and happy coding :)Aminopyrine

© 2022 - 2024 — McMap. All rights reserved.