I'm trying to pod install this library into my project's (lets say child xcodeproj) parent project (lets say Parent xcodeproj).
Child .xcodeproj has its own podfile where I have added RxSwift, RxCocoa, Realm and this GeoSwift library. Here is the cocoapods file as show below
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "9.0"
inhibit_all_warnings!
use_frameworks!
project 'LocationManager/LocationManager'
def pods
pod 'GEOSwift'
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
pod 'RealmSwift', '~> 3.0'
end
target 'LocationManager' do
pods
target 'LocationManagerTests' do
inherit! :search_paths
pod 'RxBlocking', '~> 4.0'
pod 'RxTest', '~> 4.0'
end
end
This LocationManager is installed into another XCode project as another podfile
def location_pods
pod 'GEOSwift'
pod 'LocationManager', :git => 'git#github.com:myrepo/locationmanager.git', :branch => 'users/me/add-geoswift'
end
target 'TestApp' do
location_pods
project 'TestApp.project'
end
When I try to compile the TestApp target, XCode throws an error as below
GeoSwift module is not found. This error is inside the Pods > LocationManager > MockLocationManager.swift The same module imported else where in that Pods > LocationManager works. Also import RxSwift and import RxCoca works. When I accessed Pods > Targets > LocationManager > Build Phases > Target Dependencies I see all the pods except GeoSwift
May I know how to fix this issue? Adding GeoSwift to this targetDependency doesn't compile either. When compiling LocationManager.xcworkspace as a separate entity it works perfectly fine. That module import GeoSwift doesn't throw any compilation error.
I had an issue similar to this.
Go into Pods:
Then click on "Build Settings", find the row titled "Swift Language Version", and try updating it to the latest (in my case, it was 4.1).
This worked for me! Hopefully it helps someone else out there too.
More info: Xcode 9 Swift Language Version (SWIFT_VERSION)
From what I know Cocoapods do not support sub-projects. I had an issue with this too and I promoted all my sub-projects as folders within the main project and put them under a different target. Now those targets can use Cocoapods too.
When defining my Podfile as below, and then building my app with my extension I get a build error in the DKImagePickerController framework with an error similar to this: Error "'sharedApplication' is unavailable: not available on iOS (App Extension)...." when compiling after pod update
As you can see I have not included the DKImagePickerController framework in my extension target in my Podfile, so I'm wondering what I am doing wrong?
platform :ios, '10.0'
def base_pods
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'DKImagePickerController', '~> 3.4.0'
...
pod 'SAMKeychain'
end
target 'MyApp' do
use_frameworks!
base_pods
target 'MyAppExtension' do
pod 'Firebase/Auth'
pod 'SAMKeychain'
end
target 'MyAppUnitTests' do
inherit! :search_paths
pod 'Firebase'
pod 'FirebaseAuth'
pod 'FirebaseUI/Auth'
end
end
Update
I appreciate that I am getting the error due to an API being unavailable, what I am trying to figure out is how to avoid it. My suspicion is on my podfile, hence my question :)
I had the same issue, so for anyone else finding this thread, I was able to solve the problem by creating two top-level targets instead of using a nested target.
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Eureka', '~> 3.0'
pod 'ChameleonFramework', '~> 2.0'
pod 'SharedPod', '~>1.0'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp Today' do
use_frameworks!
# inherit! :none
# Pods for MyApp Today
pod 'SharedPod', '~>1.0'
end
To get a clean start I then ran...
pod deintegrate
-- Then cleaned out the project file in XCode
pod install
There are few API's which are unavailable in App Extension's. One of them is UIApplication. The framework developer has to make sure this never happens. https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionOverview.html#//apple_ref/doc/uid/TP40014214-CH2-SW6
I can't run my test case due to this following errors :
The bundle “UITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
Library not loaded: #rpath/Alamofire.framework/Alamofire.
Reason: image not found
Try searching and solving since two days but couldn't get through this issue can someone please help.
I was able to reproduce this issue with the project generated by Xcode 10.1. I used Swift 4.2 and CocoaPods 1.10.0 as a dependency manager. I had the following Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Alamofire', '4.8.1'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
Then I removed use_frameworks!, see this link for more details:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MyApp' do
# Pods for MyApp
pod 'Alamofire', '4.8.1'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
I also received some warnings like this:
[!] The `MyAppUITests [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-MyApp-MyAppUITests/Pods-MyApp-MyAppUITests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
That's why I removed this line from the MyAppUITests build settings:
After that run pod deintegrate && pod install and then the problem disappeared.
Probably for projects with more dependencies (like here) you need to use another solution.
It's because your pods only apply to your Framework target and no the tests one. Add the tests target to your podfile.
Example :
target 'MyFramework' do
use_frameworks!
pod 'Alamofire', '~> 4.5'
end
target 'MyFrameworkTests' do
use_frameworks!
pod 'Alamofire', '~> 4.5'
end
In your tests target change inherit! :search_paths to inherit! :complete.
See the documentation for what this does.
Check that the deployment target in your UITest target Build Settings is set to the same as the host application you are trying to test. In my case, I added the UITesting target later on, and it created it with a default of deployment target iOS 12. If you then try to run the UITest on iOS lower than 12, it gave me the error mentioned in the question.
In my case, I needed to separate the UI tests target with use_frameworks!.
Moving the UI tests target from nested structure to its own will not help, if you specified use_frameworks! globally somewhere in the top of the Podfile.
The Podfile with error (original):
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
target 'MyProject' do
pod 'R.swift', '~> 5.0'
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
target 'MyProjectUITests' do
inherit! :search_paths
end
end
The Podfile with error (first try to fix):
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
def shared_pods
pod 'R.swift', '~> 5.0'
end
target 'MyProject' do
shared_pods
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
end
target 'MyProjectUITests' do
shared_pods
end
The final working Podfile:
platform :ios, '10.0'
inhibit_all_warnings!
def shared_pods
pod 'R.swift', '~> 5.0'
end
target 'MyProject' do
use_frameworks!
shared_pods
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
end
target 'MyProjectUITests' do
shared_pods
end
I had to add the location of my frameworks to Runpath search Path under targets>mytestTarget>Build Settings>Runpath Search Path
This error happened to me when I added a framework to the project (that's a framework itself, too), and tried to run the tests. I made it optional instead of required, and the tests succeeded.
Switching to legacy build system fixed thi issue with Xcode 10.
For anyone encountering this issue using Carthage, I solved it by adding the /usr/local/bin/carthage copy-frameworks run script phase to the UITest target (rather than just my main app target), and added the framework as an input file.
The bundle UITests couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle
I have run on this problem when tried to run UI Testing Bundle for testing a Framework
The solution is simple:
Build Phases -> + -> New Copy Files Phase -> <select a framework> -> Destination Frameworks
As a result <UI_Testing_Bundle_name>-Runner.app is generated
]3
Go To Build Phases
Open Copy Pods Resources and copy the path
Paste the path that you have copied from Copy Pods Resources and change tag name resources with frameworks
Clean and Build
Run your UITestsFile
What solved my problem was following the following steps:
1) delete the UITests target from the pod file.
Initially, I had the following in the pod file:
target 'XUITests' do
inherit! :search_paths
end
2) Deintegrate the pods (with pod deintegrate)
3) Install the pods (with pod install)
4) Clean your project and run the project or your UITest
In my case, just removing inherit! :search_paths without changing the structure of the file or duplicating any pod fixed my problem.
I saw the answer but without an explanation so decided to post mine.
The issue is that UI tests performed in a separate application that controls the main one and so it can't use the main application's frameworks and so if you just inherit paths to frameworks using Cocoapods UI tests app will crash at the startup.
To fix the issue you need to actually copy frameworks to UI tests app or update your Podfile:
use_frameworks!
target 'App' do
pod 'Alamofire'
target 'App_UnitTests' do
inherit! :search_paths
pod 'Quick'
pod 'Nimble'
end
end
target 'App_UITests' do
pod 'Alamofire'
end
Xcode 11.2 using Apollo framework within another framework. Instead of changing to optional/required, I fixed it by setting to embed.
With this specific error:
The bundle “XXX” couldn’t be loaded because it is damaged or missing
necessary resources. Try reinstalling the bundle. Library not loaded:
#rpath/Apollo.framework/Apollo
I had to embed the framework
For me, the error was when build the UITests.
The solution:
The Targer was with a wrong iOS version, I replace with the same version that the tested Target and everything works!!
For me, this problem was caused by me referencing a property from an extension on a UIKit class from a framework which wasn't imported in the file where it was referenced. Fixed by not using that property. I'm not sure why it compiled in the first place - that should have been a compile-time error, not a runtime error.
In my case simply choosing "My Mac" instead of "My Mac (Mac Catalyst)" allowed me to run the tests.
Try copy every pod for your app target to the UI testing target.
2019 it works.
If you are in fact using Cocoapods, you probably just need to run "pod install" and the build settings will be updated automatically.
I have been looking up on every website that had a similar/identical issue to this Xcode error and I have tried everything and nothing has worked. Most people say cleaning and building the project will make Firebase recognized but that hasn't worked. I've tried a bunch of different framework search paths but each framework is in a different folder, not one framework folder. This is my podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'Target' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Target
target 'TargetTests' do
inherit! :search_paths
pod 'Firebase', '>= 2.5.0'
# Pods for testing
end
end
these are my project folders
i've tried making my framework search path $(SRCROOT) and all variations and nothing works. My issue seems to be unlike any other that I can find from googling. I suspect its the framework search path but i don't know what to make it, and I could be wrong.
Any help would be greatly appreciated.
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Promposal
target 'Promposal' do
pod 'Firebase', '>= 2.5.0'
# Pods for testing
target 'PromposalTests' do
inherit! :search_paths
pod 'Firebase', '>= 2.5.0'
end
end
You were writing your podfile properly and you were adding the Firebase only to the test. Try this podfile and check.
It was good for me:
platform :ios, '10.0'
use_frameworks!
def shared_pods
pod 'Firebase'
end
target 'TargetName' do
shared_pods
end
target 'TargetNameDev' do
shared_pods
end
I've got an iOS app, that now needs an osx build. As it's 80%-ish shared code I've added an OSX build to the project.
With my cocoapods I'm getting a few build errors (after pod install, also tried pod update)
Also found I had explicitly add a pod to the osx target to get it do the link and build phase magic in the workspace file.
The first and key error:
Target 'Pods-scoreosx' of project 'Pods' was rejected as an implicit dependency for 'Pods_scoreosx.framework' because it doesn't contain platform 'macosx' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'
Any one know what I'm doing wrong?
edit:
Current Podspec file:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
use_frameworks!
pod 'EmitterKit'
pod 'SwiftDate'
pod 'CocoaAsyncSocket'
pod 'ReactiveKit', '~> 1.0'
pod 'ReactiveUIKit', '~> 1.0'
pod 'ReactiveFoundation', '~> 1.0'
pod 'AsyncSwift'
target 'score' do
end
target 'scoreTests' do
end
target 'scoreUITests' do
end
target 'scoreosx' do
pod 'EmitterKit'
end
target 'scoreosxTests' do
end
target 'scoreosxUITests' do
end
The error message says you need to explicitly configure the platform for the target. Setting declaring the platform in the target would help.
target 'scoreosx' do
platform :osx
pod 'EmitterKit'
end