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.
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.
Is it possible to create a framework which only works on a specified app bundle identifier?
I want to prevent to reuse ur framework by shipping out my app source code / project which is using a selfmade framework
If you ship source code, you cannot prevent the code from being reused. If you want to ship the compiled framework, you can use the approach described in the answer of Reinier Melian.
You could also consider creating a pure library instead of a framework. See here and here for the differences.
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 can not use Realm within my framework as a framework because apple rejects nested frameworks.
However maybe there is no problem in using Realm as a pod depedence within my framework. Or is there a problem?
How does objective C be a single namespace I will not have collisions?
In my framework I want to capture GPS coordinates.
What is the benefit of using Realm for this versus file system?
Thanks
You're correct that the iOS App Store doesn't allow nested dynamic frameworks. The suggested solution is to place frameworks at the same directory level in your app bundle.
The benefits of using Realm are well documented on the official website: https://realm.io
I have been following framework making tutorials for building my frameworks and one thing I noticed that after building the framework, the example states to use the .Xcodeproject along with other codes needs to be referenced to the example project to use the framework, that should not happen, if so happened, what is the need of the framework as there will be no security of the code?
can anyone throw some light on this to resolve the doubt?