user3418619
user3418619

Reputation: 235

SDWebImage Library getting error with swift 3 Xcode 8.0

My Project was Developed with Xcode 7, Yesterday I have updated it with Xcode 8 and convert swift coding with latest swift version swift 3.0. Now it gives me error on some place all most I have solved all but not getting ID for ambiguous use of sd_setImage(with: ,placeholderImage: ,completed) line. can any one help me to solve this? I am using SDWebimage Library to load image in my application.

enter image description here

Thanks

Already checked this link but not getting what to do. Ambiguous use of 'sd_setImage(with:placeholderImage:completed:)' with Swift 3

Upvotes: 1

Views: 2273

Answers (2)

Muhammad Ahmed Baig
Muhammad Ahmed Baig

Reputation: 726

Hey i think this will resolve your problem

YOURIMAGEVIEW.sd_setImage(with: URL(string: IMAGEURL), 
placeholderImage: UIImage(named:"PLACEHOLDER"), options: [], completed: { 
(image, error, cache, url) in
   DispatchQueue.main.async {
      YOURIMAGEVIEW.image = image
   }
})

from that https://stackoverflow.com/a/39024894/4720374

Upvotes: 0

JorisT
JorisT

Reputation: 1552

Swift 3 has a new way of interpreting Obj-C headers, seems like there are now 2 method signatures from 2 diff classes colliding.

A temporary fix could be using the url:placeholderImage:options:completed variant.

    view.sd_setImage(with: photoURL, placeholderImage: placeHolderImage, 
options: [.continueInBackground, .lowPriority]) { (image, error, cacheType, url) in
     ...
    }

Upvotes: 3

Related Questions