I have a perfectly fine running UITest target in my app that runs fine on the Intel based old Mac.
If I take the pull of this same code in my M1 Mac, the UITests fail even before execution.
The app is launched when the test is ran but it ends up in "test failed" and the debugger says:
“MirageUITests” couldn’t be loaded because it doesn’t contain a version for the current architecture. Try installing a universal version of the bundle.
2021-07-08 00:04:33.819224+0530 MirageUITests-Runner[59250:3764976] (dlopen_preflight(/Users/jake/Library/Developer/Xcode/DerivedData/Mirage-bjcrubavwaoeufgtdntitbgnmgae/Build/Products/Debug-iphonesimulator/MirageUITests-Runner.app/PlugIns/MirageUITests.xctest/MirageUITests): no suitable image found. Did find:
/Users/jake/Library/Developer/Xcode/DerivedData/Mirage-bjcrubavwaoeufgtdntitbgnmgae/Build/Products/Debug-iphonesimulator/MirageUITests-Runner.app/PlugIns/MirageUITests.xctest/MirageUITests: mach-o, but wrong architecture)
It seems that this UITest target only has mach-o arch. which is not enough. It also says, Try installing a universal version of the bundle but that is XCFramework where 1 bundle could pack both sim. and device archs. How can this be possible for simulator only use case?
Related
I tried running my app on a iOS emulator but I keep getting an error error: Runner.app/Info.plist does not exist. The Flutter "Thin Binary" build phase must run after "Copy Bundle Resources". I have the newest MacBook Pro M1 chip run Big Slur.
It is good that you included that you have an M1 in your question.
However in this specific case, that is not the cause of your error (I also have an M1).
Please check this issue:
https://stackoverflow.com/a/65435745/15443004
Before applying the changes there however, try a simple "flutter clean" in the project directory.
I added swift package dependency mongoSwift driver to my Xcode project when I run my project the error is displaying as:
Library not loaded: /usr/local/opt/mongo-c-driver/lib/libbson-1.0.0.dylib" Reason: libbson-1.0.0.dylib: mach-o, but not built for iOS simulator.
Make sure the library's deployment target is not higher than your project's target and that you have compatible xcode versions
Mangoswift only supports macOS and Linux.
We only support MacOS
and Linux. [1]
I've installed Xcode 10 and upgraded my iOS application to Swift 4.2. When I run my tests (both UI and Unit) via Xcode, on an iPhone simulator running iOS 12, the tests successfully start. When I attempt to run the tests on a simulator running a prior iOS version (e.g. iOS 10.3.1), I get a "failure to load the test bundle". These tests were running successfully on Xcode 9.4. I can run my app on this older simulator without an issue.
The Xcode output is as follows ("Reading List" is the application name):
2018-09-16 15:11:36.667 ReadingList[11401:11478426] Failed to load test bundle from file:///Users/andrewbennet/Library/Developer/Xcode/DerivedData/ReadingList-edsxqugqvkymbgfrbivbjmzebuya/Build/Products/Debug-iphonesimulator/ReadingList.app/PlugIns/ReadingList_UnitTests.xctest/: Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Users/andrewbennet/Library/Developer/Xcode/DerivedData/ReadingList-edsxqugqvkymbgfrbivbjmzebuya/Build/Products/Debug-iphonesimulator/ReadingList.app/PlugIns/ReadingList_UnitTests.xctest/ReadingList_UnitTests): no suitable image found. Did find:
/Users/andrewbennet/Library/Developer/Xcode/DerivedData/ReadingList-edsxqugqvkymbgfrbivbjmzebuya/Build/Products/Debug-iphonesimulator/ReadingList.app/PlugIns/ReadingList_UnitTests.xctest/ReadingList_UnitTests: mach-o, but not built for iOS simulator" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Users/andrewbennet/Library/Developer/Xcode/DerivedData/ReadingList-edsxqugqvkymbgfrbivbjmzebuya/Build/Products/Debug-iphonesimulator/ReadingList.app/PlugIns/ReadingList_UnitTests.xctest/ReadingList_UnitTests, NSDebugDescription=dlopen_preflight(/Users/andrewbennet/Library/Developer/Xcode/DerivedData/ReadingList-edsxqugqvkymbgfrbivbjmzebuya/Build/Products/Debug-iphonesimulator/ReadingList.app/PlugIns/ReadingList_UnitTests.xctest/ReadingList_UnitTests): no suitable image found. Did find:
/Users/andrewbennet/Library/Developer/Xcode/DerivedData/ReadingList-edsxqugqvkymbgfrbivbjmzebuya/Build/Products/Debug-iphonesimulator/ReadingList.app/PlugIns/ReadingList_UnitTests.xctest/ReadingList_UnitTests: mach-o, but not built for iOS simulator, NSBundlePath=/Users/andrewbennet/Library/Developer/Xcode/DerivedData/ReadingList-edsxqugqvkymbgfrbivbjmzebuya/Build/Products/Debug-iphonesimulator/ReadingList.app/PlugIns/ReadingList_UnitTests.xctest, NSLocalizedDescription=The bundle “ReadingList_UnitTests” couldn’t be loaded because it is damaged or missing necessary resources.}
The line mach-o, but not built for iOS simulator seems like it could be key. How can I resolve this?
The test targets had the iOS Deployment Target setting left as the default value.
In Xcode 9.4, this is equal to "iOS 11.4", yet the tests can still be run on an "iPhone 7 (10.3)" simulator for some reason. In Xcode 10, there seems to be a change in behaviour since the tests no longer run on simulators running iOS versions prior to the default "iOS 12".
In the Project Navigator, select the project file.
Select the Target in the Project configuration window.
Select Build Settings tab, (Basic and Levels)
Scroll down to iOS Deployment Target and then select the desired OS version.
That solved the problem for me.
cheers
rgds Dave
I have an iOS app and a set of unit tests for it (XCTests) and I would like to run these tests on aws device farm on an iOS device. AWS documentation is a bit vague but I found a great post describing steps in detail (http://cleanswifter.com/amazon-device-farm-xctest-tutorial/)
If I don't use XCTAttachment inside a XCTest - everything works fine. However if I want to use it - the app fails to load .xctest bundle with the following error:
2018-03-21 11:28:46.769 Testing[259:6945] The bundle “TestingTests”
couldn’t be loaded. Try reinstalling the bundle.
2018-03-21 11:28:46.770 Testing[259:6945]
(dlopen(/var/containers/Bundle/Application/B59ACE41-3F1F-4209-983D-
415BC47F118B/Testing.app/aatp/test-bundle.xctest/TestingTests, 265):
Symbol not found: _OBJC_CLASS_$_XCTAttachment
Referenced from: /var/containers/Bundle/Application/B59ACE41-3F1F-4209-
983D-415BC47F118B/Testing.app/aatp/test-bundle.xctest/TestingTests
Expected in: /private/var/containers/Bundle/Application/B59ACE41-3F1F-
4209-983D-415BC47F118B/Testing.app/aatp/XCTest.framework/XCTest
in /var/containers/Bundle/Application/B59ACE41-3F1F-4209-983D-415BC47F118B/Testing.app/aatp/test-bundle.xctest/TestingTests)
So for some reason it fails to find XCTAttachment symbol. The same code runs fine on simulator locally. It's a single view app built with XCode 9.2, iOS Deployment target is 10.3.
Has anyone had similar issue?
Project can build properly on iphone 4s simulator but trying to run UITest on it gives me the error :
The bundle “MyappUITests” couldn’t be loaded because it doesn’t contain a version for the current architecture. Try installing a universal version of the bundle.
Can't seem to figure out the root cause for this, tests are running properly on every other simulator.
Any thoughts?
I have solved this problem setting "iOS Deployment Target" of the UITest target to iOS 9.0. It was created with 11.1 value by Xcode.
I experienced this error while trying to get a new M1 Macbook Pro to run XCUITests.
I had set Excluded Architectures (in the Build Settings) for Simulator SDK to be arm64 for both the main target and the XCUITests target. Removing this exclusion from the XCUITests target fixed this error.
Hope this helps some others who are having a nightmare like me with the new M1 Macbooks... wish I'd never upgraded.
Following up on the above answer by Charlie Seligman, I also had an issue running XCUITests. Was able to solve it by setting all options under "Build Active Architecture only" to "no", in XCode build settings. Details: https://github.com/appium/java-client/issues/1444#issuecomment-781078298