WeTransfer/Mocker

Issue on linking Mocker while building on device or archiving

AvdLee opened this issue · 8 comments

Hey Antoine! Hope you’re doing well. I’m using the Mocker library for unit testing API calls but I noticed the latest version causing build issues for device on Xcode 12 and when archiving. I get an error that a non-public symbol is being used for swift_FORCE_LOAD$_XCTestSwiftSupport, seems like it could be related to arm64 linking.

  • Integrated through SPM
  • Reverting back to 2.2.0 removed the issue

This is likely caused by the 2.3.0 release, more specifically this PR.

I'm on Xcode 12.3: Getting the same issue on version 2.4.0 and 2.2.0 - I can build on simulators, but get the error above when building on my device (Iphone 11 pro). This might be part of a much larger issue: ReactiveX/RxSwift#2127.

I've not been able to find the cause of this. We're running the project on Xcode 12.3 without any issues, even on a device 🤔

I'm seeing the same issue, even building for simulator, using Xcode 12.2/12.3 and Mocker 2.4.0. Switching to Mocker 2.2.0 allowed my project to compile as well.

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

I had the same issue. Switching to Mocker 2.2.0 fixed it

I had the same issue. Switching to Mocker 2.2.0 fixed it

I really wonder how this is happening to you. We're using the latest version of Mocker in all our projects at WeTransfer and we never run into this error.

Can you share which Xcode version you're using and how you integrated Mocker?

@AvdLee

Can confirm it's still happening on my machine:

Spec:
CPU: M2
Xcode: 14.2
Alamofire: 5.6.4
Target: iPhone 14 Pro Simulator (arm64)

Reverting to Mocker 2.2.0 solved the issue
I used the tutorial in the Readme.md to integrate Mocker

func test_OK() {
        let configuration = URLSessionConfiguration.af.default
        configuration.protocolClasses = [MockingURLProtocol.self]
        let sessionManager = Alamofire.Session(configuration: configuration)
        
        
        let originalUrl: URL = URL(string: "Some URL")!
        let mock = Mock(url: originalUrl, contentType: .json, statusCode: 200, data: [.post: <Some Data here>])
        mock.register()
        
        let expectation = XCTestExpectation(description: "Create JSON")
        
        Task {
            // Call application code here //
        }
        wait(for: [expectation], timeout: 5.0)
}
AvdLee commented

@nurkenn-keda you've shared code that looks good. What issue are you actually facing?