Xcode 7 - Code coverage data generation failed

前端 未结 19 2648
無奈伤痛
無奈伤痛 2020-12-25 09:32

When I run my tests I get an error:

Code coverage data generation failed.
Unable to retrieve the profile data files from \'UIDevice\'.

相关标签:
19条回答
  • 2020-12-25 10:18

    This problem can also appears when you use Cocoapods with a framework where some dependencies are missing. For example if you are using Framework A, and this framework depends of Framework B but in the Podspec of Framework A the dependency is not declared.

    0 讨论(0)
  • 2020-12-25 10:21

    I solved this problem, just like I solve most of those XCode Problems:

    1. delete your projects files in your DerivedData (Xcode>Preferences>Locations>DerivedData→ to jump there in finder)
    2. Product>Clean
    3. (keep alt-Button pressed) Product>Clean Build Folder
    4. Quit XCode
    5. Restart XCode
    6. Remove your app from your device / simulator

    Try again. In case it still doesn't work, use another simulator / device for a few runs. Sooner or later it will work again on the original one again.

    0 讨论(0)
  • 2020-12-25 10:22

    Steps that worked in my case Delete the scheme and clicking Manage Scheme->Auto generate scheme resolved the issue in my case.

    Issue was caused by installing the certificate in the simulator and in the keychain

    0 讨论(0)
  • 2020-12-25 10:24

    If you are using cocoa pods, check this thread on the Cocoapods repository: https://github.com/CocoaPods/CocoaPods/issues/5385#issuecomment-226269847

    This fixed my problem:

    Copying @dfleming response:

    For some reason, it appears that CocoaPods is not adding the "[CP] Embed Pods Frameworks" build phase to the UI Tests target when generating the project workspace.

    I manually added this in and the UI Tests were runnable again.

    This build phase should run the following script: (Replace {YourProject} with your project name)

    "${SRCROOT}/Pods/Target Support Files/Pods-{YourProject}UITests/Pods-{YourProject}UITests-frameworks.sh"

    0 讨论(0)
  • 2020-12-25 10:24

    After a long time trying to figure this out, it turned out that I had to create a brand new test target. Then after rebooting the device the problem no longer resurfaced.

    0 讨论(0)
  • 2020-12-25 10:24

    Carthage users:

    This happened to me after I added a new framework to my Cartfile.

    I ran carthage update but forgot to drag the .framework file from Finder into the Embedded Binaries section of my app target!

    Once I did that, the problem went away.

    (Note this is a specific case of the general problem mentioned by @Mustafa above.)

    0 讨论(0)
提交回复
热议问题