How to compile `.framework` file? - ios

I searched through existing Stackoverflow questions related to this problem but didn't find any help to solve it.
So here's the problem:
I am trying to integrate .framework file into the project but it's giving me an error saying that module compiles with 4.0.3 can't be imported by swift 5.0 compiler.
I wanted to know how to compile that.framework file? so that it will become compilable to swift 5.0
Please help if you come across such a problem.
Note: .framework file is created by a third-party developer

If the framework you're trying to integrate is binary only, then your best option is to check with the 3rd party developer regarding their support for Swift 5.0.
In case there are sources available, you can try checking if there is any work being done in their repository (usually a separate branch), or you can try forking the sources yourself.
Note that with the source option, you'll have access to possibly unstable and untested code, and depending on the experience I'd be very careful in this case.

Related

Using a modified PDFTron Tools Framework

I'm working on a iOS Framework (using CocoaPods) that, as of today, uses PDFNet.framework as its only dependency.
Everything works as expected when I use the resulting framework in another "top level" project.
Now I'm trying to make this same Framework use the Tools.framework, as I intend to use the annotations from the Tools library.
Is there a common approach in doing so?
I've tried building the Tools source code but it fails as the dependency isn't found.
Everything you need should be in the following guide.
https://blog.pdftron.com/2016/11/14/getting-started-with-pdfnet-for-ios/
If that guide does not help, then please answer my comment above.

Basic Mechanics of iOS Frameworks and Xcode (and Swift)

I think I just must be stupid.
I'm having a lot trouble understanding very basic things concerning frameworks in Xcode/iOs/Swift. While I've certainly gotten some things to work, I've gotten more and more confused about what I'm actually doing. And the documentation on the web just confuses me more.
When I see discussions about how to import particular frameworks (e.g. https://github.com/danielgindi/Charts is the library I'm playing with, but I've seen this pattern repeated in other libraries) they seem to always tell me include the Xcode project file as a child project of my project, in addition to linking things as an embedded binary. This confuses me. Is it not possible to link an already compiled framework to my project without including all the source code of the project?
That is, can't I just take a library.framework file, and add it to my embedded libraries list and be done with it?
In the frameworks I've played with (again https://github.com/danielgindi/Charts is my primary example, but this is true in many others I've played with) I can't seem to use the framework without Carthage or CocoaPods. For me at this stage, that is just confusing... I accept that they are useful tools to automate a difficult process, but I'd really like to understand what that process actually is before I let a tool automate it for me. As I search the web I just seem to always be led back to these tools as being the correct way to do things.
So here are my questions.
If I find a framework library on the web... do I need its source code or can I somehow just link to a compiled version of the framework?
In my reading, it seems that libraries made with Swift are somehow second-class citizens because Swift is a newer thing. Is that still the case? (The articles I read about this seems to date from 2014-2015).
Is there are good place to understand how Apple expects me to add a framework to a project, without using CocoaPods or Carthage?
No need to add source code. Just add the framework to Target ->
General -> Linked Framework and Libraries -> Tap on + and select
your framework.
In my opinion, many new libraries are being written is Swift. So you won't be left behind for using swift.
Apple has documentation about adding frameworks to XCode. But I would suggest to use Cocoapods , as its easy to manage libraries.
Cheers :)

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.

What is the difference in .embeddedframework.zip and .framework?

I am attempting to extend some functionality to a plugin designed for use in Unreal Engine 4. Using the documentation available and reviewing the solution I've encountered something I do not understand and cannot figure out a way to research it.
In this plugin, the original developer has 2 different files *.embeddedframework.zip, in each of these files there are some binary files, module maps, and *.h files. These *.h files are able to include iOS modules.
I have been able to create .framework builds using Xcode, unfortunately, the do not seem to contain the same format as the *.embeddedframework.zip file.
I apologize for the vague question; I'm new to iOS and I'm quite stumped, any leads whatsoever would be appreciated! (code available on request but it's really quite boilerplate)
YourFramework.embeddedframework.zip is just a zip archive of the Xcode products that takes the following form:
YourFramework.embeddedframework.zip
> YourFramework.embeddedframework/
> YourFramework.framework/
After you link it and build, you can verify that the unzipping worked by checking here:
/Users/Shared/Epic Games/UE_4.17/Engine/Intermediate/UnzippedFrameworks/

Akavache Sqlite linking errors

I am having an issue with SqlCipher and Akavache on iOS. When I add the Akavache library to my project with an existing implementation of SqlCipher I get a number of duplicate sqlite errors during linking.
What is the current behavior?
When I build iOS with Link SDK assemblies I receive the following
Sqlite Linking Errors
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Install/Implement SqlCipher
Install Akavache
Build Xamarin.iOS project
What is the expected behavior?
That Akavache Sqlite and SqlCipher Sqlite just work together.
Which versions of Akavache, and which platform / OS are affected by this issue? Did this work in previous versions of Akavache?
Akavache 5.0.0
iOS 10.3
I wouldn't know. SqlCipher was implemented months ago, and we are just now adding Akavache to the project.
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Linking is set to SDK Asemblies only
This is a Xamarin Forms project and the Android Linking does not produce the same result.
I am actually able to execute the code on Android and have proven that the technologies play nice (from what I can tell)
I contacted SqlCipher and the recommended approach is to fork Akavache and swamp the following line of code with another
implementation.
https://github.com/akavache/Akavache/blob/develop/src/Akavache.Sqlite3/SQLite.cs#L224
Before I go down the road of maintaining a fork, I was wondering if there is better way?
What you're effectively doing here is adding Akavache, which contains a custom SQLite build, to an app which already contains a custom SQLite build. And because of the way iOS linking is done, that's a problem.
I doubt you actually need a "fork" of Akavache. What you really need, IMO, is an implementation of Batteries_V2.Init() which talks to the SQLCipher instance you already have in your app.
This is doable, as SQLitePCL.raw already contains multiple implementations of this "bundle" concept, and uses bait and switch to change from one to another.
Your question is equivalent to one I get from time to time: "How do I use a custom SQLite build with SQLitePCL.raw?" The only difference in your situation is that you already have such a custom build as part of your app. Anyway, it's similar, and unfortunately, SQLitePCL.raw doesn't make this as easy as it should.
Anyway, explaining how to bridge the gap between Akavache and your existing SQLCipher build is probably beyond the scope of this SO answer, but I might be able to help you head in the right direction. You can post an issue on https://github.com/ericsink/SQLitePCL.raw and I will see it.
I have minimal interest in adding Cipher support to Akavache. If you can find a non-terrible way to do it then release it on GitHub for others. Akavache already has an encryption API via http://kent-boogaart.com/blog/password-protected-encryption-provider-for-akavache
It's a little concerning that the authors of Sqlite Cipher are recommending removing that line as it means you'll also run into and experience problems with the greater Sqlite ecosystem, including azure mobile services.

Resources