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.
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
The use case is the following:
We developed an SDK, that uses, among other dependencies, GoogleAnalytics.
The SDK was shipped in old-fashioned way of adding our files + our other dependencies.
One of the dependencies is googleAnalytics lib, that the client's used later also for(by) GoogleTagManager (also non-pod import).
Now, we moved our SDK to be shipped as pod and all our dependencies (GoogleAnalytics libs i.e.) "moved" to the pod project with us, so the TagManger doesn't now include them (GoogleAnalytics looks missing in original project - "red" file).
Adding it also to the original project created a "duplicate files" linker error while the current state is raising linker error because tag manager doesn't have its GoogleAnalytics dependency.
What is the proper solution to this situation?
Why does it doesn't "know" the Google analytics lib from the pods target if the rest of the project do?
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.
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.
Trying to setup and get going with the RestKit library for a cocoa project (NOT iOS) and have followed the instructions precisely at RestKit Installation on Xcode 4.x as a Git Submodule
The issue now is when I try and run and I get the following issue inside RKObjectManager when RestKit tries to compile for the first time:
defaultMappingQueue = dispatch_queue_create("org.restkit.ObjectMapping", DISPATCH_QUEUE_SERIAL);
Undeclared identifier 'DISPATCH_QUEUE_SERIAL' ?!
Any ideas what may be causing this? I'm linking all the correct libraries to the target as stated in the instructions.
DISPATCH_QUEUE_SERIAL is only defined on the OS X 10.7+/iOS 5.0+ SDKs. If you're building with an older SDK, you can pass NULL for the second parameter to dispatch_queue_create(). (Private concurrent queues won't work on older OSs, though.)