Cocoapods not setting search paths correctly - ios

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:

Related

Xcode: 'No such module' - after pulling project from Git

The problem:
We had a build on the App Store which worked perfectly, then I pulled the same commit from the Git, and the compiler was constantly alerting some missing modules. This was weird cause all of the modules were there, no change was made, and on the machine (device) of my colleague wasn't showing any error.
The error is:
No such module 'NameOfModule'
Firstly it started to show on:
import IdensicMobileSDK
After a few Cleans of Build Folder, it's not showing any more on that part.
Now is showing on:
import MaterialComponents.MaterialTextControls_FilledTextFields
This is happening on my machine (device) after pulling it from Git, on my colleague's machine (device) is working great (running and building without any errors).
What steps I took to fix it:
Clean Build Folder
Delete Xcode
Delete Cocoapods on Mac
Delete Git
Delete Homebrew
Re-install everything
None of them worked. Only pod install fixed this error, but it modified some Pod files and caused other errors. It was weird why it modified Pod files when nothing was changed.
Just in case you need to see the Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/SumSubstance/Specs.git'
target 'project' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for project
pod 'Alamofire', '~> 5.0.0'
pod 'Kingfisher', '~> 5.12.0'
pod 'ReachabilitySwift', '~> 5.0.0'
pod 'SwiftKeychainWrapper', '~> 3.4.0'
pod 'Firebase/Crashlytics', '~> 7.6.0'
pod 'Firebase/Analytics', '~> 7.6.0'
pod 'Firebase/Messaging', '~> 7.6.0'
pod 'Firebase/DynamicLinks', '~> 7.6.0'
pod 'MaterialComponents'
pod 'lottie-ios', '~> 3.1.8'
pod 'IQKeyboardManager', '~> 6.5.5'
pod 'Toast-Swift', '~> 5.0.1'
pod 'SwiftLint', '~> 0.40.1'
pod 'UPCarouselFlowLayout', '~> 1.1.2'
pod 'SOPullUpView', '~> 1.1.0'
pod 'PieCharts', '~> 0.0.7'
pod 'IdensicMobileSDK'
pod 'TagListView', '~> 1.0'
pod 'DropDown'
pod 'MnemonicSwift'
target 'project-iosTests' do
inherit! :search_paths
# Pods for testing
end
target 'project-iosUITests' do
# Pods for testing
end
end
What could be the issue and how to fix it?
Thank you in advance.

After installing Firebase with CocoaPod, I can no longer build

I'm trying to build Javascript source code as an iOS app using Cordova.
I have introduced firebase with CocoaPods, and I am very troubled because I can not build.
this is wannings
Ignoring file /Users/MYNAME/Library/Developer/Xcode/DerivedData/ProductName/Build/Products/Debug-iphonesimulator/CocoaLumberjack/CocoaLumberjack.framework/CocoaLumberjack, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64
This is Error
Undefined symbols occur in large numbers
This is my Cocoapod profile.
platform :ios, '10.0'
use_frameworks!
target 'product_name' do
use_frameworks!
project 'product_name.xcodeproj'
use_frameworks!
pod 'Firebase/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'FirebaseFirestoreSwift', '~> 0.2'
# ID Instance
pod 'Firebase/Messaging'
# config
pod 'CocoaLumberjack/Swift'
# Pods for PodTest
pod 'Fabric', '~> 1.10.2'
pod 'Crashlytics', '~> 3.14.0'
# Bluetooth
pod 'RxBluetoothKit'
# debug
pod 'SimulatorStatusMagic', :configurations => ['Debug']
# design pattern
pod 'Swinject'
# zip
pod 'Zip'
# Protect UI
pod 'iOSDFULibrary'
pod 'libb2s'
end
target 'shareExtension' do
use_frameworks!
pod 'Firebase/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'FirebaseFirestoreSwift', '~> 0.2'
# ID Instance
pod 'Firebase/Messaging'
# config
pod 'CocoaLumberjack/Swift'
# Pods for PodTest
pod 'Fabric', '~> 1.10.2'
pod 'Crashlytics', '~> 3.14.0'
# Bluetooth
pod 'RxBluetoothKit'
# debug
pod 'SimulatorStatusMagic', :configurations => ['Debug']
# design pattern
pod 'Swinject'
# zip
pod 'Zip'
# Protect UI
pod 'iOSDFULibrary'
pod 'libb2s'
end
My Enviroment:
XCode Version 11.5
CocoaPods Version 1.9.3
What I have done so far.
STEP 1 : Solved CocoaPods Warnnings.
STEP 2 : Error Id: library Not Found XXXX
→ I installed the Not Found framework with CocoaPod(And decided to install a lot)
STEP3 : Modify Library Search Paths
STEP4 : Set Build Active Architecture Only explicitly to No
If anyone has experienced a similar error, I would like some advice on the current error.
Thanks.
I solved my problem.
I found an explanation in the condition of the build using the simulator.
Premise:
Why does the iOS simulator require i386 and x86_64 symbols even though I'm on an x86_64 system only?
Implementation example:
Could not find module for target 'x86_64-apple-ios-simulator'
In my project, I have to cleat Cordiva - Firebase relationship.
After,question,I did two Implementation.
STEP1: Find out why I can't build
Refer to the above article or build on the our iPhone.
STEP2: Organize compatibility
Make CORDOVA a parent element and make other targets child elements
THANKS!!

Framework not found Protobuf

I am facing an issue wherein I needed to use FirebaseRemoteConfig for my iOS app. I included the following pod:
pod 'Firebase/RemoteConfig'
Now when I am running the command on terminal:
pod install
It shows me the error:
Framework not found 'Protobuf'
Its really frustrating as the project was running fine before this. I have tried some suggestions from stack overflow but could not resolve the issue.
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# ignore all warnings from all pods
inhibit_all_warnings!
use_frameworks!
target 'S****k' do
pod 'AFNetworking', '~> 2.6'
pod 'TPKeyboardAvoiding', '~> 1.2'
pod 'SVProgressHUD', '~> 1.1'
pod 'Google/SignIn'
pod 'Mantle', '~> 2.0'
pod 'FBSDKCoreKit'#, '~> 4.8'
pod 'FBSDKLoginKit'#, '~> 4.8'
pod 'GooglePlaces', '~> 3.0.0'
#pod 'Firebase/Core'
pod 'GoogleTagManager'
pod 'GoogleIDFASupport'
pod 'Fabric'
pod 'Crashlytics'
pod 'AppsFlyerFramework'
pod 'KissXML'
pod 'GoogleMaps', '~> 3.0.0'
pod 'AutoScrollLabel'
pod "CleverTap-iOS-SDK"
pod 'IQKeyboardManager'
pod 'TrueSDK'
pod 'HyperSDK', '0.2.90'
pod 'ExpressCheckout'
#pod "AlignedCollectionViewFlowLayout"
pod 'UICollectionViewLeftAlignedLayout'
#pod 'TGLParallaxCarousel'
pod "JuspaySafeBrowser"
pod 'Firebase/RemoteConfig'
PLEASE BACKUP YOUR PROJECT
Let's go to "Your Project" -> Build Settings
find here Find here "Other Linker Flags" and open it
delete (click on "-" sign) string "Protobuf" and string "framework" above "Protobuf"
clean build Folder (Command + SHIFT + K) and rebuild
that's all
Select Project target
Go to build phases
Search Protobuf
delete Protobuf framework
Clean build folder and then build
It is worked for me
Worked for me
delete pods
delete .symlinks
flutter clean
flutter run

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

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.

Archive build with split pods across app and watchkit extension

I have been unable to get Cocoapods to build a deployable iOS app that requires different pods for the app and the watchkit extension. I have tried a format suggested in another thread: Include pods in main target and not in WatchKit extension
but it has numerous failures, including not finding headers. Here's the closest I can get:
source 'https://github.com/CocoaPods/Specs.git'
link_with 'RailTime-WatchKit-Extension'
pod 'Reachability'
pod 'IGInterfaceDataTable'
target :'RailTime', :exclusive=>true do
pod 'ASIHTTPRequest', '~> 1.8.2'
pod 'BPXLUUIDHandler', '~> 0.0.1'
pod 'MBProgressHUD', '~> 0.9'
pod 'Appirater', '~> 2.0.4'
end
This works fine for the simulator, but fails when trying to install on a device. The first error is:
ld: library not found for -lPods-RailTime-WatchKit-Extension
I'm using the latest Cocoapods right now .37. No errors are generated when performing a pod install.
Any help would be greatly appreciated!
Ken
Here's the general format that I use for my WatchKit app. See if this helps:
source 'https://github.com/CocoaPods/Specs.git'
target 'RailTime-WatchKit-Extension' do
link_with 'RailTime-WatchKit-Extension'
pod 'Reachability'
pod 'IGInterfaceDataTable'
end
target :'RailTime' do
link_with 'RailTime'
pod 'ASIHTTPRequest', '~> 1.8.2'
pod 'BPXLUUIDHandler', '~> 0.0.1'
pod 'MBProgressHUD', '~> 0.9'
pod 'Appirater', '~> 2.0.4'
end
OK, the solution was quite simple, even though I'm not sure why it worked. As suggested in another thread, I did a 'pod init', which now creates a template that is knowledgable about the multiple targets. I then just filled it in! Here's what I have now:
platform :ios, '8.2'
source 'https://github.com/CocoaPods/Specs.git'
target 'RailTime' do
pod 'Reachability'
pod 'ASIHTTPRequest', '~> 1.8.2'
pod 'BPXLUUIDHandler', '~> 0.0.1'
pod 'MBProgressHUD', '~> 0.9'
pod 'Appirater', '~> 2.0.4'
end
target 'RailTime-WatchKit-Extension' do
pod 'Reachability'
pod 'IGInterfaceDataTable'
end
target 'RailTime-WatchKit-App' do
end

Resources