Build a framework which can use only in one iOS app? - ios

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.

Related

How to create framework with other frameworks and library dependency?

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.

Using Realm inside 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

Can't I carelessly change my framework?

Building Modern Frameworks addresses versioning and the importance of getting the API right the first time. Then, it says every app has its own copy of the framework. So then, can't I change my framework carelessly, i.e., without worrying about breaking other apps that are using older versions of my framework?
If we're talking about your own app on iOS, you can do whatever you like. The "framework" is merely a module like any other module; it is included in the app and is simply part of the app's code, so if you revise it, the next update gets the revision and the new code that uses it and there's no problem.
On OS X, however, there's an ability to install a framework into the library where the app will see it. Clearly in that case the code that uses the framework must be careful about versioning. Similarly, even on iOS, if you are using your framework as a way to convey a module to other developers, you must try not to break heedlessly their existing code that uses your framework.

Would adding Parse to an IOS Framework cause issues?

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.

Objective-C – Use library from another library

I'm using SSToolKit in my project. The SSToolKit project uses GHUnitTest. I want to use GHUnitTest in my project. Do I need to download and install GHUnitTest or can I use the one included with SSToolKit. What is the best practice to do in this situation? (my app is an iOS-app)
You can use the one bundled with SSToolKit, there is no point in downloading another library. Basically, this is the same as if you downloaded the library alone - it is just bundled with another library.
If you try to add another GHUnitTest, it will create errors (not good :D ).

Resources