ainame / Swift-WebP

A thin libwebp wrapper in Swift that provides both encode/decode APIs
MIT License
163 stars 39 forks source link

when I running on iOS simulator by Xcode, I got a fatal error #50

Open MorningStarJ opened 4 years ago

MorningStarJ commented 4 years ago

the console said: dyld: Library not loaded: /usr/local/opt/webp/lib/libwebp.7.dylib Referenced from: /Users/username/Library/Developer/CoreSimulator/Devices/BDCB7B76-F51B-42D6-B6C2-0F8B66A889C6/data/Containers/Bundle/Application/EE7CB8B0-1477-43D8-B990-A0C8097B8C25/PracticeWebp.app/PracticeWebp Reason: no suitable image found. Did find: /usr/local/opt/webp/lib/libwebp.7.dylib: mach-o, but not built for iOS simulator

ainame commented 4 years ago

@MorningStarJ Hi. What steps did you do to get that error?

MorningStarJ commented 4 years ago

@MorningStarJ Hi. What steps did you do to get that error?

add Swift-Webp to the project by SPM,.

import UIKit
import WebP

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        let encoder = WebPEncoder()
        let queue = DispatchQueue(label: "do.something")
        queue.async {
            let data = try! encoder.encode(UIImage(named: "xxxx")!, config: WebPEncoderConfig.preset(WebPEncoderConfig.Preset.picture, quality: 100))
            print("encode successful")
        }
    }
}

run it on simulator, then the error is going to happen

Reiszecke commented 3 years ago

Did you get this fixed? I'd use SDWebImage but it seems kinda bloated for my use case as I only need the webp decrypt feature

ainame commented 3 years ago

@Reiszecke No. I haven't worked on this project for a while. You are very welcome if you send me a patch to fix. I haven't tested this with Swift Package Manager's installation yet so it's likely to be broken somewhere.

maximkrouk commented 3 years ago

+1