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
Related
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.
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:
I just did install Eurika library from xmartslab
I already googled this problem, unfortunally found nothing
As usual added it to my Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'Project' do
pod 'Alamofire', '~> 3.0'
pod 'SDWebImage', '~>3.7'
pod 'ObjectMapper', '~> 1.1'
pod 'Eureka', '~> 1.5'
pod 'SDWebImage', '~>3.7'
end
After installation I got a bunch of errors:
What can cause this problem. Could it be any incompatibility with other libraries?
I suppose you are using Xcode 7.2 or older. You will have to upgrade to Xcode 7.3 or change your Podfile to pod 'Eureka', '~> 1.4.1'
I can compile the target with debug configuration, but when change to release configuration, it failed with error:
ld: framework not found Pods_MyTarget
this is the pod file:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'SnapKit', '~> 0.15.0'
pod 'ObjectMapper', '~> 0.19'
pod 'Nuke'
pod 'Nuke-Alamofire-Plugin'
pod 'RESideMenu', '~> 4.0.7'
pod 'XCGLogger', '~> 3.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'TTTAttributedLabel'
pod 'UIColor_Hex_Swift', '~> 1.4'
pod 'RxSwift', '~> 2.0.0-beta'
pod 'RxCocoa', '~> 2.0.0-beta'
pod 'RxBlocking', '~> 2.0.0-beta'
I have seen this bug many a times. I do the below workaround, this may not be the right fix.
Go to Project settings and change "Build Active Architecture Only" to "NO".
I found that I have to change the pod file to something like this:
link_with 'xxx'
target xxx do
pod xxxxxx
end
and then delete some files generated by pod manually, seems pod cannot delete them, such as the xcconfig, framework, .etc
then run 'pod install'
it works.
I'm working on a legacy iOS project as a newbie. After I updated the CocoaPods and libraries, I've got these weird errors after building the project which never happen before.
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lPods-Model
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lPods-Model is not an object file (not allowed in a library)
And here is my Podfile:
platform :ios, '7.0'
link_with ['DianaViewModels']
pod 'AVOSCloud', '~> 3.0'
pod 'PixateFreestyle'
target :Model do
link_with ['DianaModels']
pod 'ReactiveCocoa', '~> 2.2'
pod 'TMCache', '~> 1.2'
pod 'SSKeychain', '~> 1.2'
pod 'Mantle', '~> 1.3'
pod 'AFNetworking', '~> 1.0'
end
target :Test do
link_with ['DianaTests']
pod 'Kiwi', '~> 2.2'
end
target :View do
link_with ['Diana']
pod 'SVPullToRefresh', '~> 0.4'
pod 'MBProgressHUD', '~> 0.7'
pod 'SWTableViewCell', '~> 0.1'
pod 'MTMigration'
pod 'Masonry'
pod 'TTTAttributedLabel'
pod 'NJKWebViewProgress'
target :ViewDebug do
link_with [
'DianaDev',
'DianaViews'
]
pod 'Reveal-iOS-SDK'
end
end
By the way, I'm using the CocoaPods plugin in the Xcode. But a lot error are output when I check the Install Docs during integration:
Error opening xar archive: /var/folders/3x/mgl299js6k13tlrspqv21n340000gn/T/Model-ReactiveCocoa.xar
Are there some wrong configurations in my CocoaPods or Build Setting in Xcode6.3? Thanks for your help!
ADDED:
Here's my Link Binary With Libraries in the Build Phases. Does the red item mean something is wrong? It looks like this is the cause.