Cannot test on iOS 11 device

I have an older phone that I would like to use for testing. It is an iPhone 6s running iOS 11.4.1


I can run my app on the device, but I can't run any unit tests. When I try, I get the following error:


dyld: could not load inserted library '__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib' because image not found


If I try the exact same thing on my new iPhone 11 Pro running iOS 13.2.3, I get the same error, but the tests work fine.


I've only seen this problem definitively referenced one other place: github.com/CocoaPods/CocoaPods/issues/9165


I tried added "-weak_framework XCTEST -weak-lXCTestSwiftSupport" to linker flags and "$(PLATFORM_DIR)/Developer/usr/lib" Library search path, but it didn't help. I tried cleaning the build folder, deletingn the previous app, and restarting the device. Same problem.


I guess I should have upgraded to iOS 12 when I had the chance. I didn't expect to get blocked on something like this. I would like to have some backwards compatibility. Is there any other way to upgrade an iOS13-capable device to iOS 12? I think the iPhone 6 was one of the few that is only upgradeable to iOS 12. I might be able to find one of those. Any other suggestions?

Accepted Reply

I filed a bug report (FB7488431).

Thanks. Looking at your bug report it seems to have been fixed in Xcode 11.3, which was just released. When you get time, give that a whirl and let us know how you get along.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

Not sure you can get there from here on that 6s. I suspect if you try to update an otherwise compatible device from 11.x, Apple will only sign the most current iOS, that being 13.x, so yes, time to sniff out a 6, I think. I'm only sitting on a spare 6s+, tho, so can't help, sorry.

If you start with a new app from the iOS > Game template, does it have the same problem? I just tried that here, and it runs just fine on my iOS 11.4 victim device (I’m using Xcode 11.2 on macOS 10.14.6).

Note Normally I’d recommend the iOS > Single View App template, but the new template in Xcode 11 makes extensive use of

UIScene
, so it’s hard to get it running on iOS 11. The iOS > Game template has a traditional app delegate, and thus backports to iOS 11 trivially.

I think the iPhone 6 was one of the few that is only upgradeable to iOS 12.

Correct. Your iPhone 6s supports iOS 13, so there’s no supported way to get iOS 12 on it now.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I've already addressed the UIScene issue. The app runs on iOS 11. It appears to run fine, but it is just a placeholder for running unit tests at this point. It is those unit tests that don't work. On iOS 13, it runs fine and the unit tests work fine. But I still get that error message on iOS 13, even though the tests work. I don't know if the error message is even related to the failure to run tests. It seems to match the stack trace though.


Currently, the "app" is just a single view with a quit button. It only exists in this form to run unit tests. What I'm trying to test is a monster open source framework (GDAL) that has taken me about 3 weeks just to get building on iOS. These unit tests are very important for me. For one, there is an awful lot of functionality to verify on an OS where this code has never run before. For another, some components are GPL and I'll be swapping them out with my own versions, but I want to use unit tests to compare my code against the "standard" GPL libraries.


The framework is large (65 MB) but relatively simple in structure. I've gotten all of the components to link statically so that is not an issue. But given the scale of the iOS market, I'm concerned about any one-in-a-million failure as those scale up too. I'm not too familiar with iOS development either. I see many recommendations to delete derived data, clean, delete apps, reboot devices, etc.


For example, I did have trouble with a resources directory named "Resources". I had forgotten about that. So is this failure just an after-effect of that earlier configuration problem because I'm using the same device that I had tried to use with a "Resources" resources directory? Is that why the other device works fine?

I was able to answer one question. I am a creature of habit and I do have another iOS 11 device. I get the same failure on this device too. Here is the backtrace:


* thread #1, stop reason = signal SIGABRT

* frame #0: 0x000000010152e2f8 dyld`__abort_with_payload + 8

frame #1: 0x000000010152dad0 dyld`abort_with_payload_wrapper_internal + 100

frame #2: 0x000000010152dafc dyld`abort_with_payload + 12

frame #3: 0x0000000101504314 dyld`dyld::halt(char const*) + 312

frame #4: 0x00000001015073c4 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 6888

frame #5: 0x000000010150121c dyld`_dyld_start + 68

And error message: dyld: could not load inserted library '__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib' because image not found
I don't always get the error message, but it does always fail with the same backtrace.

It is not a critical issue. It just makes me a little nervous. I have an iPhone 6 on the way so I can test with iOS 12. I'm aware of rates of iOS adoption. It is just that I see random, unexplainable failures even on my Mac app. I don't want to just blame these issues on random failures or buggy Xcode. If it fails, I'm the one who has to deal with it.

Yes. A game template generates the same problem. It runs the app fine. It is the unit tests that fail to load.


I filed a bug report (FB7488431). I guess it my own fault for not planning ahead and having an iOS 12 device handy. I guess I'll just drop iOS 11.

I filed a bug report (FB7488431).

Thanks. Looking at your bug report it seems to have been fixed in Xcode 11.3, which was just released. When you get time, give that a whirl and let us know how you get along.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yes. I just noticed that.

Hi! Got the same error in Xcode 11.5 on tests start.


dyld: could not load inserted library '/Users/userName/Library/Developer/Xcode/DerivedData/AppName.-fwajxvmfpjktjnesmahlprwgbgti/Build/Products/Debug-iphonesimulator/AppName.app/Frameworks/libXCTestBundleInject.dylib' because image not found

I'm seeing this as well. It's quite strange

Hi,

Have you received a solution yet? This just started to happen to me.