Cocoapods: UITests missing 📦 Embed Pods Frameworks build phase in 1.0.0.rc.1

Created on 4 May 2016  ·  38Comments  ·  Source: CocoaPods/CocoaPods

What did you do?

I created a new project, added a podfile and added the Nimble pod to the UITest target.

What did you expected to happen?

I expected the UITest to build and run and expected that the 📦 Embed Pods Frameworks build phase exists for the UITest.

What happened instead?

Instead the 📦 Embed Pods Frameworks build phase is missing and I get the error:

2016-05-04 12:06:11.998 XCTRunner[72780:2546682] Running tests...
2016-05-04 12:06:12.005 XCTRunner[72780:2546682] The bundle “CocoaPodsUITestBugUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2016-05-04 12:06:12.005 XCTRunner[72780:2546682] (dlopen_preflight(/Users/dave/Library/Developer/Xcode/DerivedData/CocoaPodsUITestBug-ewaeojhdwdsmcegfrnbpgfiuhtsc/Build/Products/Debug-iphonesimulator/CocoaPodsUITestBugUITests-Runner.app/PlugIns/CocoaPodsUITestBugUITests.xctest/CocoaPodsUITestBugUITests): Library not loaded: @rpath/Nimble.framework/Nimble
  Referenced from: /Users/dave/Library/Developer/Xcode/DerivedData/CocoaPodsUITestBug-ewaeojhdwdsmcegfrnbpgfiuhtsc/Build/Products/Debug-iphonesimulator/CocoaPodsUITestBugUITests-Runner.app/PlugIns/CocoaPodsUITestBugUITests.xctest/CocoaPodsUITestBugUITests
  Reason: image not found)

Podfile

platform :ios, '8.0'
use_frameworks!

def shared_testing_pods
  pod 'Nimble', '~> 4.0.0'
end

abstract_target "CocoaPodsUITestBugTargets" do
  pod 'Raygun4iOS', '~> 2.2.0'
  pod 'Alamofire', '~> 3.3.0'
  pod 'PromiseKit', :git => '[email protected]:mxcl/PromiseKit.git'
  pod 'SwiftyJSON', '~> 2.3.2'

  target 'CocoaPodsUITestBug'

  target 'CocoaPodsUITestBugTests' do
    shared_testing_pods
  end
end

target 'CocoaPodsUITestBugUITests' do
  shared_testing_pods
end

I've attached an example project. All the other tests build correctly except for UITests. When I add the build phase manually, it works.

CocoaPodsUITestBug.zip

easy detailed defect

Most helpful comment

Moving the UITests target outside of the main target in the Podfile seems to have helped. So now instead of this:

target 'Target' do
  use_frameworks!
  ...

  target 'TargetTests' do
    inherit! :search_paths
    ...
  end

  target 'TargetUITests' do
    inherit! :search_paths
    ...
  end

end

we have this:

target 'Target' do
  use_frameworks!
  ...

  target 'TargetTests' do
    inherit! :search_paths
    ...
  end
end

target 'TargetUITests' do
    inherit! :search_paths
    ... # all the pods we normally use
 end

All 38 comments

5110

@segiddins Not that I know of, I'll have a look and make a PR :+1:

Any news on it? It does make our CI ui tests useless... :/

@kordziu the quickest way to get a fix in would be to make a PR

@segiddins I am very much aware of it, i just saw @neonichu was about to make PR thus asked about future of his comment :)

I can also confirm my UI test target is missing the build phase that is usually called "Embed Pods Frameworks" under a fresh 1.0.0 install.

The project built and installed on the simulator ok, but as soon as a test attempted to run it failed with output along the lines of couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.

Manually adding a new run script to this testing target and pointing it to the Pods frameworks.sh script fixes this issue.

"${SRCROOT}/Pods/Target Support Files/Pods-[ABSTRACT_TARGET_NAME]-[TEST_TARGET_NAME]/Pods-[ABSTRACT_TARGET_NAME]-[TEST_TARGET_NAME]-frameworks.sh"

Adding new run script phase to the test targeted as suggested in https://github.com/CocoaPods/CocoaPods/issues/5250#issuecomment-220061976 worked for our project, thank you @danielbowden !

I would also like to confirm both the issue and the solution @danielbowden pointed out.

Any updates on this issue?

I confirm that @danielbowden solution fixes the issue, although I am running in the same issue in the CI system that re-installs CocoaPods from the start. Do you have an ETA for when a fix will be released?

@ziogaschr the fix still isn't in master, iirc, so no eta

This issue seems to be back again. I'm experiecing this only in my UITests. But not in my normal Tests.

2017-06-12 08:13:14.205 XCTRunner[18081:458722] Running tests...
2017-06-12 08:13:14.232 XCTRunner[18081:458722] The bundle “mmUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2017-06-12 08:13:14.233 XCTRunner[18081:458722] (dlopen_preflight(/Users/houmie/Library/Developer/Xcode/DerivedData/mm-dabukmeexwmscibofwgspbnndfcs/Build/Products/Debug-iphonesimulator/mmUITests-Runner.app/PlugIns/mmUITests.xctest/mmUITests): Library not loaded: @rpath/Parse.framework/Parse
  Referenced from: /Users/houmie/Library/Developer/Xcode/DerivedData/mm-dabukmeexwmscibofwgspbnndfcs/Build/Products/Debug-iphonesimulator/mmUITests-Runner.app/PlugIns/mmUITests.xctest/mmUITests
  Reason: image not found)

The run script is renamed these days to Embed Pods Framework and seems to be set correctly.

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

Podfile:

platform :ios, '10.0'
use_frameworks!

target 'mm' do
  # Pods for mm
   pod 'SwiftDate'
   pod 'FBSDKCoreKit'
   pod 'FBSDKLoginKit'
   pod 'Fabric'
   pod 'Crashlytics'
   pod 'ParseUI'
   pod 'Parse'
   pod 'ParseFacebookUtilsV4'

  target 'mmTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'mmUITests' do
    inherit! :search_paths
    # Pods for testing
  end
end

Any advice please?

@houmie please open a new issue

I have the same issue but on iOS 11, before the upgrade everything worked fine, after the upgrade the UI tests stopped working, any advice?

I am facing the same issue here. For Unit test target installation of pods works fine. But for UI test target nothing happens.
Tried adding the run-script as suggested by @danielbowden.
The script triggered the following -

Adding Build Phase '[CP] Embed Pods Frameworks' to project.
Adding Build Phase '[CP] Check Pods Manifest.lock' to project.

But it never reached to -
Running post install hooks
Hence my ui test target is still missing .framework file and the pods.
Please help

My podfile looks somewhat like this -

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '9.0'
use_frameworks!

workspace 'XXXX'

target 'XXXX' do
    project 'XXXX.xcodeproj'

    pod 'Alamofire'
    pod 'AlamofireImage'
    pod 'AlamofireObjectMapper'
    pod 'IQKeyboardManagerSwift'
    pod 'Mixpanel-swift'
    pod 'PromiseKit'
    pod 'SwiftyJSON'
    pod 'ReachabilitySwift'
    pod 'RxSwift'

    post_install do |installer|
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['ENABLE_BITCODE'] = 'NO'
                config.build_settings['SWIFT_VERSION'] = '4.1'
            end
        end
    end

end

target 'UITests' do
    pod 'Nimble'
end

Hey I'm getting the same issue, even if i run the script, at the end i'm having same problem, did anyone find some solution?

Did anyone open a new issue yet? I am also running into this issue for my UITests

I also faced with this problem

@MerinoA Did you solve this problem?

I have not 😿

Sent from my iPhone

On Sep 14, 2018, at 4:03 AM, Alexander Khitev notifications@github.com wrote:

@MerinoA Did you solve this problem?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

This is an old issue. Please someone file a new one and provide a sample app demonstrating the issue.

@MerinoA, @alexanderkhitev Are you using Xcode 10 GM? I'm currently facing the same issue and couldn't find a workaround. Has either of you filed a new issue issue yet?

Hey @soaresbrun0 ! I'm using Xcode Version 10.0 (10A255). I didn't make a new issue.

I am facing the same issue also on Xcode 10 GM. The only workaround I could come up with was to change Build config to Release for Test in the Scheme. However this doesn't sound about right...

It seems related to the fact that instead of target "Pods_ProjectNameUITests.framework" for UITests the pods seem to be generating "Pods_TargetName_ProjectNameUITests.framework". I've replaced this name to the first one and also played a bit with commenting out "inherit! :search_paths" for this target and for a few compilations it worked.

Moving the UITests target outside of the main target in the Podfile seems to have helped. So now instead of this:

target 'Target' do
  use_frameworks!
  ...

  target 'TargetTests' do
    inherit! :search_paths
    ...
  end

  target 'TargetUITests' do
    inherit! :search_paths
    ...
  end

end

we have this:

target 'Target' do
  use_frameworks!
  ...

  target 'TargetTests' do
    inherit! :search_paths
    ...
  end
end

target 'TargetUITests' do
    inherit! :search_paths
    ... # all the pods we normally use
 end

running CocoaPods 1.5.3 on High Sierra with Xcode 10 and still encountering this issue.

Solution (https://github.com/CocoaPods/CocoaPods/issues/5250#issuecomment-220061976) did not work for me; moving the UITest target out of the main target as suggested by PWrzesinski _did_.

I thought this was resolved ages ago...?

Also seeing this problem on 1.6.0.beta.1 running on Mojave 10.14.1 Beta (18B50c), but with a unit test target for a framework.

Work around suggested by @PWrzesinski worked for me as well.

Works like a charm with the @PWrzesinski change with Mojave 10.14.1 - Xcode 10.0 (10A255) - Cocoapods 1.5.3 Thanks a lot !! 👍 🥇 this really help me!

for visibility, this is still a bug: inherit! :search_paths still doesn't work for UITests i guess

@Jerland2 I'm also still experiencing this problem with UI Tests.

This problem only occurs for me when using CocoaPods 1.6.0. If I downgrade to 1.5.3 it works.

gem uninstall cocoapods
gem install cocoapods -v 1.5.3

This issue persists in 1.6.1.

just like @masterjefferson I also have this with a regular tests target (not UI tests), on CocoaPods 1.5.3 it doesn't happen and the workaround from @PWrzesinski doesn't work because CocoaPods then says "Unable to find a target named MyProjectTests" (I've intentionally replaced the real name with MyProject here)

in my case the problematic framework is Keys, from cocoapods-keys gem. With CocoaPods 1.5.3 I see lines install_framework "${BUILT_PRODUCTS_DIR}/Keys/Keys.framework" in the -frameworks.sh target support file, but in CocoaPods 1.6.0 and 1.6.1 those lines do not exist

edit: as it turns out, my issue was more specifically the one from #7446 check if that helps you too

This issue persists in Cocoapods 1.9.3.

MacOSX 10.15.4 (Catalina)
Xcode 11.4

Work around suggested by @PWrzesinski worked for me as well.

target 'MyTarget' do
  project './MyTarget.project'
  application_pods

  target 'MyTargetTests' do
    inherit! :search_paths
    pod 'Quick'
    pod 'Nimble'
  end
end

target 'MyTargetUITests' do
  inherit! :search_paths
  pod 'Cucumberish'
end

Same issue in Xcode 11.5 and worked for me as well! @1ucas

Also experiencing this. Using inherit! :search_paths skips the addition of the Embed Pods Frameworks.
Where as using shared pods does include the phase:

target 'TargetUITests' do
  shared_pods
end
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sonu5 picture sonu5  ·  3Comments

soleares picture soleares  ·  3Comments

hmistry picture hmistry  ·  3Comments

Curtis-Halbrook picture Curtis-Halbrook  ·  3Comments

pronebird picture pronebird  ·  3Comments