UIImageView | unrecognized selector sent to instance | Xcode 6.4 | iOS 8.4

人走茶凉 提交于 2019-12-01 10:36:34

问题


I'm new at Xcode, and my task was to migrate the code from iOS 6.1 to 8.4, but there where so many deprecated methods. I solved them (I hope so), but now I got a new problem.

The code I'm using is this one:

[self.clientImageView sd_setImageWithURL:[NSURL URLWithString:_client.imageURL] placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; 

And I get this error:

[UIImageView sd_setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x7fbe937a88b0

And finally, I get this:

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView sd_setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x7fbe937a88b0'

Thank you so much.


回答1:


By the Collaborator ofSDWebImage

See https://github.com/rs/SDWebImage#add-linker-flag. Correctly setting the flags should take care of the issue. BTW: I strongly recommend you guys switch to CocoaPods, that way those issues will never arise.




回答2:


If you imported the framework and set up all of the right flags, try to delete the contents of this folder ~/Library/Developer/Xcode/DerivedData and fun a clean build. It should help.




回答3:


Just add -ObjC in other linker flags and added sdwebcache.a in link libraries




回答4:


Copy and paste all files from the library in your project. I tried everything suggested and nothing worked. At the end, simple copy paste do the work.

Also, I must say that I didn't have this problem on the new project, just in existing one. On the new project everything worked just fine.



来源:https://stackoverflow.com/questions/32255040/uiimageview-unrecognized-selector-sent-to-instance-xcode-6-4-ios-8-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!