Xcode can't find interface declaration after running "pod install" - ios

I've inherited an iOS project which uses cocoapods.
The repo includes the Pods directory with all the necessary pods frozen in time. If I clone the repo and build the app, all is fine. If I run pod update and then build, I get an error:
Cannot find interface declaration for COOperation.
The issue seems to be with a library called CompositeOperations, which is pulled in from a specific git account (not from cocoapods directly - not sure if that matters but just trying to give as much info as possible). Xcode is finding the library just fine, but for some reason it's not loading the Class declared in the interface file.
It seems silly to me to include the Pods directory in the repo. I feel like developers should clone the repo and then issue git install in order to pull down all dependancies.
Any suggestions for what I need to tweak in order for Xcode to successfully build my project?
The actual error in MessageScreenDataFetchOperation.h is:
/Users/user/src/myapp/myapp-iOS/Classes/Shared/Operations/MessageScreenDataFetchOperation.h:13:46:
Cannot find interface declaration for 'COOperation', superclass of
'MessageScreenDataFetchOperation'; did you mean 'NSOperation'?
And here's what MessageScreenDataFetchOperation.h looks like:
#import <CompositeOperations/COOperation.h>
#protocol GroupRef;
#interface MessageScreenDataFetchOperation : COOperation
- (id)initWithMessageId:(NSNumber *)messageId group:(id <GroupRef>)groupRef memberId:(NSNumber *)memberId;
#end
Here's my Podfile:
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target :MyTarget do
pod 'RestKit', '~> 0.24.0'
pod 'CompositeOperations', :git => 'https://github.com/stanislaw/CompositeOperations.git'
pod 'MBProgressHUD', '~> 0.8'
pod 'EKKeyboardAvoiding', '~> 2.0'
pod 'RBStoryboardLink', '0.1.0'
pod 'SWRevealViewController', '~> 2.0.0'
pod 'youtube-ios-player-helper', :git => 'https://github.com/stanislaw/youtube-ios-player-helper', :branch => '0.1.1-and-no-ads'
pod 'SZTextView'
pod 'MagicKit', :git => 'https://github.com/stanislaw/MagicKit'
pod 'ECPhoneNumberFormatter', :git => 'https://github.com/enriquez/ECPhoneNumberFormatter.git'
pod 'SSKeychain'
pod 'Mantle'
pod 'RSEnvironment', :git => 'https://github.com/rabovik/RSEnvironment'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
# Analytics
pod 'FlurrySDK', '5.1.0'
pod 'Fabric'
pod 'Crashlytics'
pod 'NewRelicAgent'
# Logging
pod 'EchoLogger', :git => 'https://github.com/stanislaw/EchoLogger'
pod 'AFNetworkingLogger', :git => 'https://github.com/stanislaw/AFNetworkingLogger'
end
target :MyTargetUnitTests do
pod 'OCMock', '~> 3.0'
pod 'Kiwi'
pod 'JPSimulatorHacks', :git => 'https://github.com/plu/JPSimulatorHacks'
end

Have you tried adding CompositeOperations without using pods? That pod seems outdated to cocoapods:
https://cocoapods.org/?q=CompositeOperations

Turns out the version that was baked in to the Xcode project was a much older version. The Podfile didn't restrict by version number, so running 'pod update' updated the library to the latest version, which had significant changes, making it incompatible with my code base.
I figured it out by diffing Podfile.lock after running pod update and noticing the drastic difference in versions.
I went forward with deleting the Pods directory and the .xcworkspace file, but amended the Podile to restrict the library based off a specific tag.

Related

Cocoapods not setting search paths correctly

I opened an iOS (Swift) project today I hadn't touched for a while and it wouldn't build. The first import statement for a Cocoapods framework was throwing a No such module compile error in Xcode. Changing the order of import statements made the error throw on whichever was the first external dependency in my import list.
I fixed this by adding each of my Cocoapods to Framework Search Paths in my project's main target (it has a few targets, including tests, a share extension, and a framework of shared code for the app and extension). These search paths were empty and now look like this:
After doing that the project built fine, but now I'm getting this SIGABRT error every time I try to run the app (both on simulator and device):
dyld: Library not loaded: #rpath/CocoaLumberjack.framework/CocoaLumberjack
Referenced from: [path removed]
Reason: image not found
My guess is this is to do with CocoaLumberjack needing to be linked somewhere else/some other way because of its macros but I don't really know.
I've also tried running pod install, cleaning the build folder and deleting derived data, and running pod deintegrate + pod install with no success.
Is it possible to get Cocoapods to automatically set up my search paths correctly so I don't have these issues? Or is there a manual step I'm missing or have done wrong perhaps?
Edited to add my Podfile:
platform :ios, '11.0'
use_frameworks!
# ignore all warnings from all pods
inhibit_all_warnings!
# This is my shared framework, used by both my app and share extension
target 'XXXShared' do
pod 'SnapKit', '~> 4.0'
pod 'KeychainSwift', '~> 7.0'
pod 'Reveal-SDK', :configurations => ['Debug']
pod 'IQKeyboardManagerSwift'
pod 'APESuperHUD', :git => 'https://github.com/apegroup/APESuperHUD.git'
pod 'WSTagsField', '~> 3.1'
pod 'Cache', '~> 4.2'
pod 'TableKit', '~> 2.5'
pod 'GRDB.swift', '~> 3.2'
pod 'PromiseKit', '~> 6.0'
pod 'Toast-Swift', '~> 3.0.1'
pod 'CocoaLumberjack/Swift'
pod 'CollectionKit'
pod 'PinLayout'
pod 'FlexLayout'
pod 'LayoutKit'
pod 'PromiseKit/Alamofire'
pod 'Alamofire', '~> 4.7'
end
target 'XXX' do
pod 'Reveal-SDK', :configurations => ['Debug']
end
target 'XXX share extension' do
inherit! :search_paths
end
Edited to add screenshots:

Unable to install pod 'FBSDKLoginKit' Completely It just stop there

The pods are taking forever to install. They just stop there. I tried it for 30mins and also tried to make it work on dummy project but still the install was not successful. My podfile looks like this.
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Benefit' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Benefit
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'
pod 'ImageSlideshow', '~> 1.4'
pod 'MIBadgeButton-Swift', :git => 'https://github.com/mustafaibrahim989/MIBadgeButton-Swift.git', :branch => 'master'
pod 'Charts'
pod 'SideMenu'
pod 'JTHamburgerButton', '~> 1.0'
pod 'SwiftyJSON'
pod 'Alamofire'
pod 'Google/SignIn'
pod 'GoogleSignIn'
pod 'FBSDKLoginKit'
end
Terminal output
Analyzing dependencies
Downloading dependencies
Using Alamofire (4.6.0)
Installing Bolts (1.9.0)
Using Charts (3.0.4)
Installing FBSDKCoreKit (4.29.0)
Installing FBSDKLoginKit (4.29.0)
-
Well I kept the terminal as it was and after an hour It was done with installing, I think there was a problem on server side of pods.
Just check your internet connection. And speed up Your net connection.
Happy coding :)

gRPC-Core Compile Errors - Apple Mach-O Linker Error after Swift 4/Xcode 9 Update

After updating to Xcode 9.1 from 8.3.3 a project I am working on has multiple errors stemming from gRPC-Core bundled with Firebase. The errors make no sense whatsoever (to me at least) and I have tried all the usual fixes (removing pods, reinstalled, pod update, clean, build, delete derived data, etc). Cocoapods version is 1.3.1
Pods being used in the project (everything working fine before update, no other errors from other pods).
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Firestore'
pod 'FirebaseUI/Firestore', '~> 4.0'
pod 'FirebaseUI/Storage', '~> 4.0'
pod 'FirebaseUI/Auth', '~> 4.0'
pod 'FirebaseUI/Facebook', '~> 4.0'
pod 'FirebaseUI/Google', '~> 4.0'
pod 'UITextField+Shake', '~> 1.1'
pod 'SJFluidSegmentedControl', :git => 'https://github.com/adornoventura/SJFluidSegmentedControl.git'
pod 'GoogleBooksApiClient'
pod 'Kingfisher', '~> 4.0'
pod 'BarcodeScanner'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'Stripe'
pod 'Lightbox'
pod 'SwipeCellKit'
Edit: To those with the same problem, this issue is being tracked here: https://github.com/firebase/firebase-ios-sdk/issues/423 and it stems from the Firestore pod.
gRPC Team fixed this issue with the release of pod version 1.7.1. To anyone with this problem, clear your pod cache (pod cache clean) then do a fresh install to get the latest version!
I have the same problem. I guess there is a problem with the gRPC-core and a link is missing..
when I am not mistaken, it is used from Firestore and I guess it is since the last update from gRPC-Core
i only have
pod 'Firebase/Core'
pod 'FirebaseUI/Auth'
pod 'Firebase/Firestore'
developers posted following on Github:
Looks like an issue in gRPC-Core. For the time being you can work around this by putting
pod 'gRPC', 1.6.5
at the top of your Podfile.

Cocoapods : target has transitive dependencies that include static binaries when installing 'VialerSIPLib'

I'm trying to install an objective-c Wrapper for Jsip 'VialerSIPLib' and use it in my swift project here is my pod
platform :ios, ’10.0’
use_frameworks!
target 'EMedicalAdmin' do
pod 'ObjectMapper', '~> 2.1'
pod 'Alamofire', '~> 4.3'
pod 'SwiftyAvatar', '~> 1.0'
pod 'AlamofireImage', '~> 3.1'
pod 'Eureka', '~> 2.0.0-beta.1'
pod 'JSQMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :branch => 'develop'
pod 'PKHUD', '~> 4.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'ImageSlideshow', '~> 1.1.0'
pod 'SwiftyJSON'
pod "FlexibleSteppedProgressBar"
pod 'BTNavigationDropdownMenu', :git => 'https://github.com/PhamBaTho/BTNavigationDropdownMenu.git', :branch => 'swift-3.0'
pod 'VialerSIPLib'
end
but i get this error when installing :-
target has transitive dependencies that include static binaries:
and if i remove
use_frameworks!
from my podfile it would work but all my other swift based pods won't work
so, i'm left with using only this one pod (VialerSIPLib) or Use all my other pods except it
Please add this to your podspec: s.static_framework = true
This is available from cocoapods version 1.4.0.
It worked for me.!!
use_frameworks! should be enough but sometimes the pod.lock file gets corrupted.
So you can delete the pod.lock file and then do
pod repo update and pod install
if any one is Still wondring ,it can't be Done
Using dynamic vendored frameworks shouldn't be a problem even if the
developer isn't using CocoaPods with use_frameworks!, unless they for
some reason need a static lib, such as if building a command line
tool, where static linking is preferable.
So .You Could add the static library manually and link it in you project or wait for the vendor to Change the library into a dynamic Framework
More info here
For me this is how i solved it :-
1- Downloaded the static library using Cocoapods without use_frameworks!
2- used Carthage for Adding other libraries
3- and if a library Doesn't have a Carthage support i would do it manually (Not advised since alot of Duplicate dependencies may Appear)
I put up a repo to show how to do: https://github.com/Lucashuang0802/CocoaPodsWithCarthage
There are a couple things to do:
- install your objective-c lib via CocoaPods without indicating use_framework! in the Podfile
- install your pure Swift module via Carthage
You should be able to compile fine with this solution.
It's a weird one.
For me uninstalling and installing again worked.
Steps -
Comment(#) the error causing pod in pod file
Pod install
Uncomment the line in pod file and save
Pod install

Build error when using both objective-c and swift libraries with Cocoapods

I have an Objective C project which has a podfile like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'Linbik' do
pod 'AFNetworking', '~> 2.6.0'
pod 'DateTools', '~> 1.6.1'
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-swift.git', :tag => '2.1.3'
end
DateTools is an Objective C library, and Sentry is a Swift one.
If I remove Sentry pod and use_frameworks! line, and then run pod install, pods are correctly installed and project builds just fine.
But if I run pod install with the podfile above, pods are correctly installed but I can't build the project. It gives me an error like this:
'NSDate+DateTools.h' file not found with <angled> include; use "quotes" instead
The import is done like this:
#import <NSDate+DateTools.h>
This is just part of the code that gives me an error. There are also some imports like this:
#import <AFNetworking/UIImageView+AFNetworking.h>
That gives the same error.
Xcode suggests me to use double quotes on import, but that doesn't help.
What can I do?
I found the solution by deleting derived data.
Change pod 'AFNetworking', '~> 2.6.0' And use this
pod 'AFNetworking', '~> 3.0
pod 'DateTools', '~> 1.6.1'
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-swift.git', :tag => '2.1.3'

Resources