I'm trying to add test cases for my project having the cocoa pods library dependency. The test runs successfully in simulator but are failing in the real device.
This is the error printing to the console:
LLVM Profile Note: Profile data not written to file: already written.
This is the logs in the report navigator:
'My app' (3303) encountered an error (Failed to load the test bundle. If you believe this error represents a bug, please attach the result bundle at /Users/thejask/Library/Developer/Xcode/DerivedData/App_'My app'-avoubniynzjjhuabshcihhylvtej/Logs/Test/Test-App_'My app'-2022.07.26_17-38-44.xcresult. (Underlying Error: The bundle “'My app'UnitTests” couldn’t be loaded. The bundle couldn’t be loaded. Try reinstalling the bundle. dlopen(/var/containers/Bundle/Application/49E31128-198A-4489/'My app'.app/PlugIns/'My app'UnitTests.xctest/'My app'UnitTests): tried: '/var/containers/Bundle/Application/4489-A61F-78FAA42490E4/'My app'.app/PlugIns/'My app'UnitTests.xctest/'My app'UnitTests' (code signature in <8FB4A0F1-2472-3BEC-817D-5EEA70E88D49> '/private/var/containers/Bundle/Application/49E31128-A61F-78FAA42E4/'My app'.app/PlugIns/'My app'UnitTests.xctest/'My app'UnitTests' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/private/var/containers/Bundle/Application/49E3-4489-A61F-78FAA42490E4/'My app'.app/PlugIns/'My app'UnitTests.xctest/'My app'UnitTests' (code signature in <8FB4A0F1-2472-3D-5EEA70E88D49> '/private/var/containers/Bundle/Application/49E31128-1989-A61F-78FAAE4/'My app'.app/PlugIns/'My app'UnitTests.xctest/'My app'UnitTests' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)))
I've tried removing code coverage and enabling it in scheme. And adding or removing the frameworks in build phases of test target. No use.
This is the test class code.
import XCTest
import _TV
class _TVUnitTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
}
func testOS() throws {
let sample = SampleTestClass()
let result = sample.sampleTestCase()
XCTAssertTrue(result)
}
This is very embarrassing. Now that I have to answer my own question.
After updating Xcode and iOS to the latest versions, issue disappeared, but not sure how this had happened. Anyway, if anyone have any info on this, please let me know.
My current updated latest versions :