I have a CocoaPod that has AFNetworking as a dependency (current version is 2.6.3).
At the same time I want to use RestKit which still uses AFNetworking 1.3.0.
Is there a "sane" way of mangling my AFNetworking symbols so that they don't conflict with RestKit?
Example podspec file snippet:
s.dependency 'JSONModel', '~> 1.1'
s.dependency 'tolo','~> 1.0'
s.dependency 'AFNetworking', '~> 2.0'
In another project, I have:
pod 'RestKit'
pod 'MyLibrary'
The result:
[!] Unable to satisfy the following requirements:
- 'AFNetworking (= 1.3.4)' required by 'Podfile.lock'
- 'AFNetworking (~> 2.0)' required by 'MyLibrary (2.0)'
I've also tried using CocoaPods packager but without success. The dependencies of MyLibrary for some reason are not included in the mangled framework.
I've also tried to mangle only AFNetworking, but again no success as I can't point to a local dependency in the podspec file (!?).
If your using RestKit in your project you can't use AFNetworking 2.x as RestKit is tightly integrated with AFNetworking 1.3.x Your options are to use AFNetworking 2.x and remove RestKit from your Podfile or use RestKit and remove your dependencies for AFNetworking 2.x A quick google search for AFNetworking 2.x vs RestKit should bring up a lot of articles covering the subject. I hope my comments help you out.
Related
I'm creating my first cocoapod. It has a dependency on RMStore, so I added s.dependency "RMStore" to the podspec file. However, when I'm working on my framework, I always get errors saying that RMStore isn't available. So how do I handle this?
After adding s.dependency, you do indeed need to run pod install against your project so that the pods download and the pods project correctly references everything. Assuming you have an Example/Tester project with a Podfile that points to "your pod", this will download RMStore and configure everything for you.
I prepared an example of how to do dependencies in developed pods and it's available here:
https://github.com/ericwastaken/CocoaPod-Dependency-Demo
I'm working on a project that uses both RestKit and CocoaLumberjack. The project also uses some other pods, some of them only exist in swift. I use cocoapods 0.38.2 for dependency management, my podfile looks like this (removed other pods for readability):
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'RestKit'
pod 'CocoaLumberjack'
I need to use use_frameworks! because of those other pods that are swift-only. I try to compile this using Xcode7 beta 5, I get the following errors:
"_OBJC_CLASS_$_DDLog", referenced from:
objc-class-ref in RKLumberjackLogger.o
ld: symbol(s) not found for architecture x86_64
So I took a look into the offending file and found this:
#if __has_include("DDLog.h")
#import "RKLumberjackLogger.h"
#import "DDLog.h"
Looks like the entire file resolves to nothing if the DDLog.h is not present, in which case I think the RestKit logging falls back to NSLog or whatever. Otherwise, the Lumberjack logging is used, which is what I want.
After some investigation, my suspicion is that the RestKit somehow sees the CocoaLumberjack headers (where the DDLog.h is), but is not properly linked against it when the project is built. Feel free to question this in case you have better ideas, but I can confirm that going to the CocoaLumberjack sources and manually adding DDLog.m as a member to the RestKit framwork target allows me to compile the project properly.
So, my question is, what is the correct way of fixing this? RestKit is not directly dependent on CocoaLumberjack, but tries to detect it and use it if possible, but fails miserably. Is there a way to link RestKit with Lumberjack from my project level so I don't have to modify the pods?
Example project can be found here
Your suspicion is correct.
RestKit somehow sees the CocoaLumberjack headers (where the DDLog.h is), but is not properly linked against it when the project is built
This is a problem with RestKit and everything that you would do within your own project would be a workaround. So arguably, there is no single correct way to fix this in your project.
I have filed a Pull Request with a fix for this issue.
Update:
The pull request has been merged, but at the time of writing this update, no new version of RestKit has been released yet.
pod "RestKit", :head, :subspecs => ['Core', 'CocoaLumberjack']
RestKit's Lumberjack logging functionality has been moved into a separate subspec that you have to specify if you want to use it.
:head will tell CocoaPods to use the current master instead of a released version.
What I need is create a Pod that will have several other Pods (MBProgressHUD, SVProgressHUD) included in as a dependencies. So my goal is to have a MultiProgressHUD (so for example show different progress huds depending on configuration)
I have created a CocoaPods Project using pod lib create.
I have made the steps provided by CocoaPods and I have my project here:
https://github.com/dahiri-farid/PSMultiProgressHUD
When I do:
`pod lib lint PSMultiProgressHUD.podspec `
I get:
`PSMultiProgressHUD passed validation.`
My concern is that in the generated project I don't have the sources of the linked dependencies pods. So the biggest concern is for example that how I will develop my Pod if I can not even compile it because I don't have the dependecies sources. I have tried many commands and read some docs, but did not found usefull info. So can anyone please help me on that? Or explain me the workflow with CocoaPods dependencies?
The RKValueTransformers's version is 1.1.0 and RestKit's is 0.20.3, both installed by cocoapods. After installation, I find in project there is 2 RKValueTransformers.h file, one is standalong RKValueTransformers, and the other is in RestKit. They cause conflict in building phase, does anyone know how to resolve this problem?
The compile error is:
/Code/Pods/RestKit/Code/CoreData/RKManagedObjectMappingOperationDataSource.m:85:5: Unknown type name 'RKDateToStringValueTransformer'; did you mean 'RKCompoundValueTransformer'?
Upgrade the RestKit version to the latest one (0.23.3). Or the first one which has RKValueTransformers as a dependency (0.21.0). Then remove RKValueTransformers from the podfile. RestKit will add it automatically as a dependency.
Reasoning --
This is what was happening -- RestKit versions 0.20.3 (and earlier) have its own version of RKValueTransformers (.h and .m). So when you have RestKit 0.20.3 and also add RKValueTransformers, RestKit still refers to its own version, and not the pod you added. When you upgrade your version of RestKit, it starts referring to the pod dependency.
When I use cocoapods to add AFNetworking to my workspace, everything appears to be in place but I am unable to instantiate any AFHTTPClient instances in my code. The files: AFHTTPClient.h and .m are not present anywhere within the AFNetworking hierarchy.
Currently, my Podfile looks like this:
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.0'
pod 'Parse', '1.2.17'
And my CLI pod update command runs fine from the terminal as shown below:
nmaster >> pod update
Analyzing dependencies
Downloading dependencies
Using AFNetworking (2.0.3)
Using Facebook-iOS-SDK (3.11.0)
Using Parse (1.2.17)
Generating Pods project
Integrating client project
The error I am seeing in my code is shown below:
I've seen a number of posts referring to the HEADER SEARCH PATH being insufficient but I've already confirmed that the files themselves do not exist. Has AFHTTPClient been deprecated? I did find a copy in one of Ray W.'s tutorials of both the AFHTTPClient.h and .m files and tried to drag/drop those into my project but that led to duplicate references and other problemos.
Anyone have any ideas of where I should attack this problem?
Thanks, Phil
AFHTTPClient has been replaced by other classes in AFNetworking version 2.0. See also here: https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-2.0-Migration-Guide. If you specify version 1.6.x (from memory) and iOS 6.1 in your podfile, you can still use the old version and keep your code.