orion
orion

Reputation: 408

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

When launching my app on an iPad running the iOS 13 beta 2 build I receive a SIGABRT. This build works fine on the simulator

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

I thought maybe it was a linking problem, but Combine does not appear in the list of libraries available to link.

Does anyone have a work around or am I sunk until the next beta?


Here is my code snippet:

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()
    }
}

Upvotes: 3

Views: 682

Answers (2)

Ugo Arangino
Ugo Arangino

Reputation: 2958

Your Xcode Beta and your iPadOS/iOS Beta version should match. Otherwise it can happen that Combine can not be linked to your application.

Upvotes: 2

Rob
Rob

Reputation: 438122

When I tested the following (as well as your code snippet) in Xcode 11.0 beta 3 (11M362v) running on iPad Pro w 13.0 (17A5522f), it worked fine.

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()
    }
}

Upvotes: 0

Related Questions