In my project I have RestKit and IDMPhotoBrowser(using Cocoapods), so there is two versions AFNetworking conflict among themselves. Do you have any idea how to use them both in same project?
There is no way to use 2 libraries with the same classes in the same project. This is what leads to duplicate symbol errors. On the topic of RestKit + AFNetworking this has been brought up a few times. There's another StackOverflow question, there's tons of issues but it sounds like they want to remove AFNetworking as a dependency entirely (from here).
Related
Years ago, using ObjC and frameworks (and frameworks inside frameworks), it was common from time to time the “duplicate symbols” error. For example, if you created a framework including RestKit and then the app that wanted to use that framework was using RestKit too, you had that error. One way to fix it was to rename the included source code into your framework using a prefix. Or just avoid using 3rd party dependencies on your framework. Note we used to use static libraries, rather than dynamic libraries.
Is it possible to have the same problem with pure swift apps/frameworks and dynamic libraries today? As far as I understand, swift uses the concept of module for namespaces, something we didn’t have with ObjC.
I mean, is it possible to create a framework that uses Alamofire (let’s say version 5), and then create an app that uses Alamofire (let’s say version 5.0.1) AND your framework that uses Alamofire too?
I am using a similar setup and i did not face any such duplicate symbols in my project.
Let me share my experience.
I have a project setup like the one below.
Main Project -> uses PromiseKit via Cocoapods
My Framework -> uses PromiseKit via Cocoapods
Main Project uses My Framework
I did not face any such issue while running this setup. IMO, hope it is taken care by Swift compiler.
I know, there are so many same questions but I didn't get answer for my requirement.
First time I am creating framework. I have created test framework using Raywenderlich example. But my requirement is little bit different. I used so many different frameworks and also used SQLCipher in my project. Now, I want to convert this project into framework. I followed all the steps but the problem is occur when I am trying to build. Getting an error for SQLCypher because I didn’t add to my framework to avoid conflicts. Finally, I have added SQLCypher library to create build without error and it worked but now I am getting linker error when I am using that framework to test in testProject. I didn’t find any example with third parties. Please help me to solve this issue.
I had the same issue.
One solution is to change all method names of other frameworks or libs, but some lib is not open source.
Another solution is work for me which is to use cocoapods. But the user
who wants to use your framework will be forced using cocoapods, depending iOS 8.0 or above, depending the same version of 3rd libs. I have nothing to do with this restriction.
Seems the best way is do not depend 3rd libs in a framework.
I've got an on going project where I'm using AFNetworking for request/response layer. And I want to use RestKit's ObjectMapping functionality for my JSON responses. I tried to install RestKit via cocoapods but it's going into conflict with already installed AFNetworking pod. So I wanted to ask if there any way to install RestKit's ObjectMapping module only, and without networking layer?
You can have a look here https://github.com/RestKit/RestKit/issues/2028 where is under discussion the possibility to create a branch of RestKit without the AFNetworking dependency. In the meantime you can drop AFNetworking in your Podfile and let RestKit include it; the only downside with this approach is that you are stuck to AFNetworking 1.x.
You can add "RestKit/ObjectMapping" as a Cocoapod dependency for your project without the base networking layer.
Or else check out the work in progress for RestKit issue 2028 in https://github.com/oligriffiths/RestKit. It doesn't require AFNetworking at all, but it may need your help getting to a stable state and passing all the tests.
If I am building a Framework that depends on Parse, would this cause issues for apps already using Parse and would like to use my framework? More specifically, if I initialize my Parse app in the framework, and then the app using this framework initializes Parse again, would they interfere?
Yes, they will and that's the reason CocoaPods exist, to ease the pain of dependency of frameworks.
Framework must not depend on another framework is the bottom line. If you do , it will leads to collisions, if the other framework also includes that framework.
I would suggest you to learn CocoaPods. The dependency problems will find the solution.
So I'm trying to get with the times and use some of the new features offered in AFNetworking 2.0. However, I am also using RestKit 0.20 which has AFNetworking 1.3 as a dependency? Am I allowed to incorporate AFNetworking 1.3 and 2.0 into my Xcode project or can I only pick one? Is there a CocoaPod trick for this?
https://github.com/AFNetworking/AFNetworking
https://github.com/RestKit/RestKit
CocoaPods does not (currently) do dependency resolution with multiple versions of the same library. I'm not sure about the technical difficulties surrounding this but I believe one way to think about why it would be a pain is duplicate symbol errors that we've all undoubtably seen before. Unless RestKit updates their AFNetworking integration, which would take some doing I'm sure for such a large library, you'll have to pick which one you need more.
I wanted to mention that if you're using RestKit, this framework is meant to Abstract out you Networking operations, so if you project allows for it, it would be best not to use AFNetworking directly, and let restKit do the work instead. Being that said, I would also point out that you can use the dependency used by restKit (i.e 'AFNetworking', '~> 1.3.0'), and Just Use the previous API provided by AFNetworking, in case you really need to make direct use of this library.
Hope it helps =)