22

I'm running unit tests on my iOS project and when it's running, it crashes and spits this out:

dyld: could not load inserted library '/private/var/mobile/Containers/Data/Application/1CAB64C8-D730-427B-8E9E-BD5E152ACFD6/tmp/IDEBundleInjection.framework/IDEBundleInjection' because no suitable image found.  Did find:
/private/var/mobile/Containers/Data/Application/1CAB64C8-D730-427B-8E9E-BD5E152ACFD6/tmp/IDEBundleInjection.framework/IDEBundleInjection: mmap() error 1 at address=0x00436000, size=0x00004000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Data/Application/1CAB64C8-D730-427B-8E9E-BD5E152ACFD6/tmp/IDEBundleInjection.framework/IDEBundleInjection

I'm using XCode 7.0 and testing on an iPod running iOS 8.3. I have deleted the derived data and I've restarted XCode and it still hasn't worked.

FireDragonMule
  • 1,347
  • 2
  • 16
  • 27
  • Does this happen on an iOS 9.0 device/simulator? It might be caused by using the Xcode 7 beta on an incompatible iOS version. – Kevin Sep 05 '15 at 02:40
  • I run my unit tests on the device itself because some of my frameworks are arm7-only. The device I'm using is an iPod running 8.3. – FireDragonMule Sep 05 '15 at 02:48
  • I had the same problem with an iPhone 5 (iOS 9.1) but if I use simulator it works correctly – Miguel Nov 20 '15 at 11:55
  • I have the same issue... It runs well on simulator but not on device, do you have a solution for this? – Mikael Mar 08 '16 at 06:47

9 Answers9

5

I fixed this by just creating a new UnitTest target, copying everything over, and removing the old one.

FireDragonMule
  • 1,347
  • 2
  • 16
  • 27
  • 1
    If you got a better answer, feel free to post and I'll select yours. This post has been voted up several times so people want an answer even if it's not the best one. – FireDragonMule Dec 14 '15 at 21:00
  • 2
    Oh sorry that wasn't a criticism. I upvoted it myself. It was just a sarcastic statement of the truth. – Michal Dec 15 '15 at 06:32
  • this only worked for me after rebooting the device(iOS10 device in Xcode8) – Pellet Nov 14 '16 at 01:04
5

In General Panel , not leave the Team to "None"

enter image description here

At Same time : select the code sign in Build Setting->Code Signing-> Code Signing Identity

taojigu
  • 457
  • 5
  • 5
4

I managed to fix this by specifying my developer certificate in build settings->code signing identity.

Timur Suleimanov
  • 435
  • 5
  • 16
1

I fixed this by selecting the correct target and then selecting the correct Code Signing Identity from Settings. It was set to a non default - changed to 'IOS Developer' for the Debug setting entry.

John Goodstadt
  • 678
  • 8
  • 13
1

In my case there was nothing wrong with the provisioning profiles, it was down to the Architectures in the project excluding arm64. Once arm64 was added to both the test target and the host app target the tests ran fine (On Xcode 7.2). The error was:

dyld: could not load inserted library '/private/var/mobile/Containers/Data/Application/A94F5AD3-2A5F-415D-B127-0F45DEC7A659/tmp/IDEBundleInjection.framework/IDEBundleInjection' because no suitable image found.  Did find:
/private/var/mobile/Containers/Data/Application/A94F5AD3-2A5F-415D-B127-0F45DEC7A659/tmp/IDEBundleInjection.framework/IDEBundleInjection: mmap() error 22 at address=0x00501000, size=0x00005960 segment=__LINKEDIT in Segment::map() mapping /private/var/mobile/Containers/Data/Application/A94F5AD3-2A5F-415D-B127-0F45DEC7A659/tmp/IDEBundleInjection.framework/IDEBundleInjection
1

I had this same issue and had to reboot my device. I was using iOS 10 with Xcode 8.0 (developing in swift 3.0)

konop
  • 21
  • 5
  • Same here; a device reboot worked fine. Restarted Xcode as well for good measure. iOS 10.2.1, Xcode 8.2.1, Swift 3.0 project. – John Whitley Feb 01 '17 at 01:33
0

I needed to set the team under Project->App Target->General. It was set to "None", instead of a valid team.

Drew
  • 8,675
  • 6
  • 43
  • 41
0

I had my base SDK in XCode Build Settings set to a more recent version of iOS than the phone had, so I had to upgrade the OS on the phone.

JBaczuk
  • 13,886
  • 10
  • 58
  • 86
0

I fixed this issue by rebooting my iOS Device.

OmniBug
  • 892
  • 8
  • 12