Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running unit tests in Xcode 8 causes error "could not load inserted library '.../IDEBundleInjection' because image not found"

I am suddenly running into the error when testing my iOS 10 app in Xcode 8.

dyld: could not load inserted library
'__PLATFORMS__/iPhoneOS.platform/Developer/Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection' 
because image not found

The app's tests ran successfully before. I had then deleted the skeleton UI Test Case class that was created together with the project, so this may have caused the problem (somehow). I have since recreated that class, but the problem remains.

What exactly does the error message indicate and how can I overcome the problem, i.e. successfully run the app's unit tests again.

UPDATE There must be another root case, for if I create another (empty) Single View Application project in Xcode and run its unit tests, the same error occurs.

The error only occurs when running unit tests on a device, not on simulators.

UPDATE This response from Apple to a similar report suggests the error is related to code signing. The app itself runs fine on the same device, so how could there be a code signing issue in my case?

like image 775
Drux Avatar asked Oct 03 '16 21:10

Drux


1 Answers

Try these one by one:

  1. Try to create a new UnitTest target, copying everything over, and removing the old one.

  2. In General Tab Panel, do not leave the Team to "None". Select your team. And select the correct Code Signing Identity from Settings. It was set to a non default - changed to 'IOS Developer' for the Debug setting entry.

  3. Disable "Enable guard Malloc" from diagnostics to run app in device.

  4. This may be because Xcode mount wrong DeveloperImage. If you open the Settings-> Developer you will see that the "Enable UIAutomation» and others are missing. To fix:

    (A) move all folders from "/Applications/Xcode8.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport" except "10.0 (12A4297e)" to safe place (B) reboot the phone (C) connect your phone to xCode 8 (D) restore folders in DeviceSupport

    This is the only thing that helped me. Even re-flashing on ios10 does not helps.

  5. This is old, but it may help you: In the target's General tab, there is an Embedded Binaries field. When you add the framework there the crash is resolved.

Reference is https://devforums.apple.com/message/991384#991384 on Apple Developer Forums.

Best of luck!

like image 120
Jamshed Alam Avatar answered Nov 13 '22 01:11

Jamshed Alam