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?
Related
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?
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
My Application has deployment target 8.0. It works well with device running above iOS 10.0, but it gets crashed in the device running below iOS 10.0. Here is the error which I got from console
dyld: lazy symbol binding failed: Symbol not found: _sqlite3_key
Referenced from: /var/containers/Bundle/Application/887A192E-F390-47F6-80F3-768F4F321C8A/xxxx.app/xxx
Expected in: dyld shared cache
Below are the things I have tried to fix this, but nothing worked for me
Force Cleaned the application.
Reloaded the console.
Added the following architectures (armv7s, arm64, armv7).
Deleted the libsqlite3.tbd and added once again.
Generating the build with distribution profile and installed the same in device and tried (Gone through in some threads and found it happens only in the DEBUG mode).
I have an application developed using NativeScript+AngularJS which I need to do some automated UI testing on a physical device. I am using Calabash for this and it worked out of the box for my Android version but i'm having some difficulties with the IOS version.
I have followed the setup guide here and here and completed each step. I can query everything on the screen when running bundle exec calabash-ios console so the calabash server is running on the phone. When trying to execute the command start_test_server_in_background I get the following error:
dyld: Library not loaded: #rpath/FBControlCore.framework/Versions/A/FBControlCore
Referenced from: /Library/Ruby/Gems/2.0.0/gems/run_loop-2.4.1/lib/run_loop/device_agent/bin/iOSDeviceManager
Reason: image not found
And when I try to run the command APP=< path to .app generated by NativeScript > DEVICE_ENDPOINT=http://192.168.254.208:37265 DEVICE_TARGET=9d7929c174c0f8f11408a834a258ac2af3 bundle exec cucumber
I get the same error noted before.
Have tried:
The command above with the specified bundle id for the application but with no different outcome.
The command above with APP=< path to .app generated by XCode >
Manually importing the FBControlCore.framework in both XCode and the NativeScript IOS build.xcconfig file
Device Information:
IPhone 6s
IOS version 10.2.1
When I try to run an UI and Unit tests, I get an exception:
dyld: could not load inserted library
'/private/var/containers/Bundle/Application//AutoTestingApp.app/Frameworks/IDEBundleInjection.framework/IDEBundleInjection'
because no suitable image found. Did find:
dyld: Library not loaded: #rpath/XCTest.framework/XCTest
App builds with success but fails when running a test.
I already tried:
reinstalling Xcode
checking a provisioning profiles and a certificates
What am I doing wrong?
For what it's worth, you might be able to avoid this issue by running your test on a simulator instead of the device. Also make sure you've set your profiles correctly: i.e. Xcode 7.0 XCTest dyld: could not load inserted library IDEBundleInjection