Cocoapods Troubleshooting
Cocoapods warning ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
When you run pod install
, Cocoapods shows the following warning (usually this happens for projects that were recently moved to Cocoapods):
Root cause
This warning indicates that the build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
that Cocoapods wants to manage has already been set in the Xcode settings and hence may conflict with Cocoapod's setting. You can find this setting in Xcode (go to Build settings of the target(s) mentioned in the warning message (in this case URLSessionMockerSampleTests [Debug]
); look for the setting Always Embed Swift Standard Libraries
in the section Build Options
).
Usually, this warning appears when existing projects are converted to use Cocoapods, because this etting may already set in Xcode and now Cocoapods wants to manage it for all the frameworks that it brings into the app target.
Solution
There are two options (as the warning also indicates) - either delete the build setting from the target OR modify the build setting in Xcode to $(inherited)
so that the value set by Cocoapods will take precedence. You can do this as follows:
In Xcode, go to the Target settings and find the build setting
Always Embed Swift Standard Libraries
Either select the settings and hit the Delete key so that it is removed from the project file
OR click on the dropdown and select
Other..
so that a text popup appears. Set/replace the text with the value$(inherited)
. Dismiss the text popup; make sure that the value is updated
Run
pod install
again. It should run without any warnings
Unit Tests Fail Without Executing
In some projects with specific Pods in Tests target, the tests will fail without even executing, i.e. Xcode test job shows "Test Failed" notification, but none of the tests would have executed. This happens even if there is only one empty test function in the whole project. The logs in Report navigator shows the following error:
I have seen this issue with a specific Cocoapod named Mocker
. Here is the Podfile for that project:
When I replaced Mocker
pod with another Pod (eg: AFNetworking
), the tests executed properly. There seems to something specific to that pod (although I couldn't find anything special in its pod spec).
Two workarounds I found for this problem were: 1. Add the offending pod outside the Tests target - as follows
Change the structure of the Podfile such that the test targets are at the same level as the app target as follows:
```
target 'URLSessionMockerSample' do
end
target 'URLSessionMockerSampleTests' do
inherit! :search_paths
Pods for testing
pod 'Mocker' end
The podspec of that pod would have a source
attribute which points to an HTTP url instead of HTTPS, for example here is a snippet from the podSpec of AppDynamics
Last updated
Was this helpful?