1

I am seeing the compiler warn that "Instance method -cacheKeyForURL not found" and "Instance method -defaultCachePathForKey not found", in the following code:

SDWebImageManager *manager = [SDWebImageManager sharedManager];
NSString *cacheKey = [manager cacheKeyForURL:[NSURL URLWithString:imageUrl]];
NSString *cachePath = [[manager imageCache] defaultCachePathForKey:cacheKey];

enter image description here

Yet clearly, these methods are defined. Here, for example, is the method definition in SDImageCache.h:

/**
 *  Get the default cache path for a certain key
 *
 *  @param key the key (can be obtained from url using cacheKeyForURL)
 *
 *  @return the default cache path
 */
- (NSString *)defaultCachePathForKey:(NSString *)key;

At the top of my code file, I am including the relevant files from the SDWebImage project:

#import <SDWebImage/UIImageView+WebCache.h>
#import <SDWebImage/SDImageCache.h>
#import <SDWebImage/SDWebImageManager.h>

Moreover, sharedImageManager is defined in SDWebImageManager.h and the compiler is having no problems finding it. I only have warnings on the 2nd and 3rd lines.

My code runs fine and these methods both work without crashing. Why is the compiler telling me it cannot find it?

I am running XCode 6, compiling for Active Architecture Only, iPhone 6 Simulator.

UPDATE

When I compile for Distribution, "All Architectures", suddenly it can find cacheKeyForURL and defaultCachePathForKey, no problem, but setImageWithURL is now deprecated?

enter image description here

I do see the deprecation warnings in UIImageView+WebCache.h, but I'm just super-confused why building for these different architectures is turning on/off various compiler warnings when the header files of SDWebImage don't seem to have anything architecture-specific to them.

esilver
  • 27,713
  • 23
  • 122
  • 168
  • 1
    are you using which version of `SDWebImage`? In new version there is a `sd_setImageWithURL`.So can you confirm this. you can use from this linkhttps://github.com/rs/SDWebImage – Nimit Parekh Mar 25 '15 at 04:29
  • Version 3.7.1, according to Podfile.lock – esilver Mar 25 '15 at 17:11

1 Answers1

1

I figured this out by more closely inspecting the error in the "Report Navigator" (neé Log Navigator).

enter image description here

It turns out that there were some very old SDWebImageManager.h files in the "Derived Data" folder that it was choosing to link against. Unclear why they did not go away upon a clean of my project. (Possibly connected to the fact that I migrated from submodules to including SDWebImage via Cocoapods?)

I used this answer on Stack Overflow to navigate to my DerivedData folder, and then I manually deleted the subfolder for my project. After doing that, the project now builds successfully without the spurious warnings.

Community
  • 1
  • 1
esilver
  • 27,713
  • 23
  • 122
  • 168