iBug
iBug

Reputation: 2352

SDWebImage library does not work with simulator

I am using SDWebImage library. It works fine when I am using iPhone but does not work when I compile with simulator. I get this error:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_SDWebImageManager", referenced from:
      objc-class-ref in ViewController.o
      objc-class-ref in DetailViewController.o
  "_OBJC_CLASS_$_SDWebImagePrefetcher", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

But it does not give any error when I compile while using iPhone device. I am using .a file.

enter image description here

Upvotes: 1

Views: 1160

Answers (1)

Julian F. Weinert
Julian F. Weinert

Reputation: 7560

If you get this error, the library wasn't compiled for the simulator (i386) architecture. This problem cannot be resolved.

You would need to get the source code an compile the lib for this architecture too. Or you might ask the author if he can compile a simulator-supported version for you.

There are possibilities to make a "fat binary" from a armv7 library that supports armv7s as well. This is because the armv7s has the same instructions, and extends the armv7.

Since the i386 has completely different instructions, there won't be a way to use a arm-only lib in the simulator.

EDIT See this support matrix for more info

EDIT II If you compile the lib on your own, you have to include the intel architecture too. Since the simulator runs on the Mac (intel processor, not ARM) the correct architecture is i386. Thee see matrix mentioned above for more details.

Upvotes: 1

Related Questions