iOS 13 Public Beta 2 - Combine.Future "dyld: Symbol not found"



在运行iOS 13 beta 2构建的iPad上启动我的应用时,我会收到一个sigabrt。此构建在模拟器上正常工作

dyld: Symbol not found: _$s7Combine6FutureCyxq_GAA9PublisherAAMc Expected in: /System/Library/Frameworks/Combine.framework/Combine

我认为这也许是一个链接问题,但是组合没有出现在可链接的库列表中。

有人在周围工作还是我沉没直到下一个beta?


这是我的代码段:

class ViewController: UIViewController {
    var future: AnyPublisher<String, Error>?
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        future = ViewController.makeNumberString(50)
        future?.sink { result in
            print("FUTURE DONE: (result)")
        }
    }
    static func makeNumberString(_ number: Int) -> AnyPublisher<String, Error> {
        return Combine.Future<Int, Error> { complete in
            DispatchQueue.global(qos: .userInitiated).async {
                complete(.success(number))
            }
        }
        .map { number in
            return "(number)"
        }
        .eraseToAnyPublisher()
    }
}

您的Xcode beta和iPados/iOS Beta版本应匹配。否则可能会链接到您的应用程序。

在Xcode 11.0 Beta 3(11M362V(上测试以下(以及您的代码段(时

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        print("viewDidLoad")
        _ = bar().sink { value in
            print("sink", value)
        }
    }
    // some old asynchronous method
    func foo(completion: @escaping (Bool) -> Void) {
        DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
            completion(true)
        }
    }
    // `Future` promise for that old async method
    func bar() -> AnyPublisher<Bool, Never> {
        Future { promise in
            self.foo { value in
                promise(.success(value))
            }
        }
        .eraseToAnyPublisher()
    }
}

相关内容

  • 没有找到相关文章

最新更新