I found this article on zipping a directory using NSFileCoordinator, without any third party frameworks.
While this approach works, how can we unzip an archive without using third party libraries? I've tried searching for it, but found no solution. If this task isn't possible, is there any documentation/evidence that highlights the same?
Third-party libraries are created by people, which means you indeed can write "unzipping" code yourself, without third-party frameworks. :)
As stated by an Apple engineer on the Apple Developer Forums, there's no simple native solution (like a method somewhere in the Foundation framework or somewhere else), so you need to write your own or rely on an existing third-party library. (The answer on the forum was also marked as recommended by Apple.)
Related
I am trying to develop a library, and then distribute it later as an SDK. In that library I am thinking of using a third party library.
What I am afraid of is if one of my users also include that same third party library. Would it still build? Otherwise, is there a way around this issue?
Note that I cannot use CocaoPods.
Yes, this can and will collide. You must not include a third-party library inside your library. You must have the app link both your library and your dependencies at the app layer. Tools like CocoaPods, Carthage, and SwiftPM simplify this. If you cannot use those, then you must provide instructions to your users of what libraries they must link.
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 :)
I know there are many third party libraries available for unzipping a file.
But are there any native Classes or Libraries available for unzipping a file?
I tried to search but did not find anything!
As far as I know there is no native library available for that, there are plenty of third party libraries available though.
However if you think of it, third party libraries are built on top of code so there is a native way to achieve that.
If you are really keen about seeing how to achieve that natively you can dive into the third part code and extract the method you want for the unzipping. However I advice you not to re invent the wheel and use it
Hope this helps!
How to unzip .zip file in objective-c + ios without third party tool/ software
like SSZipArchive or ZipArchive.
I already check many threads but not get any useful links.
If you don't want to use third party you have to implement mechanisms that frameworks make for you. So you have to repeat their already done job. If so you may as well use those frameworks.
If you are interested how this works you can just check their code.
Well you could do it with first party software (from Apple). I haven't tried it myself, but how about this: https://opensource.apple.com/source/gnuzip/gnuzip-28/gzip/unzip.c
Zip archives are nontrivial archives. Theres more to a zip archive than just the deflate compression. Apple supplies libz as a framework you can link to. But libz isn't enough to recreate a zip file's directory structure, for instance.
If you seriously want to avoid external dependencies, i'd suggest trying to convert to something that iOS can handle out of the gate: try gzip! heres a tutorial: http://www.clintharris.net/2009/how-to-gzip-data-in-memory-using-objective-c/
Otherwise, honestly, there are well supported 3rd party zip libraries that should work just fine.
My company makes a static library for iOS apps. One annoying step for developers is that they have to manually link against all the required frameworks that the library uses, and failing to do so leads to somewhat confusing compiler errors.
I would have previously thought this wasn't possible, but the company Chartboost claims to automatically link against non-default frameworks like AdSupport and StoreKit. Based on my testing in their sample app (available from the linked page), so far this appears to be the case (Even when disabling "Enable Modules" and "Link Frameworks Automatically" in the app that links against the static library).
Is there some way to enable this feature when creating a static library? I've tried enabling modules and the "Link Frameworks Automatically" LLVM options in Xcode, but so far haven't been able to get it working.
There's a piece of code called CBDynamicallyLoadedDependencies that calls dlopen() on the appropriate system library before making the function or method call.
My original answer wasn't correct. the dlopen() call is just in the x86 code. On the device, it's something different, but my ARM assembly isn't strong enough to figure it out. All I can say is that there's a piece of code that's acting as a trampoline to the desired functions and that references the system library files (like /System/Library/Frameworks/AdSupport.framework/AdSupport).
But the point is that it's not a simple project trick that makes it work normally. There's internal code involved.
They might use modules you mentioned and #import instead of #import, which should make the libraries link automatically.
For reference, check this question.
This might not be what you're looking for, but if you don't yet support Cocoapods, I would strongly advise taking a look:
http://cocoapods.org/
(Edit: Cocoapods is essentially linked to Xcode. Other IDEs will need another solution.)
You can advertise Cocoapods to developers as the "easy" way to work with your library, and the manual method as...well, the manual method. ;)
I'm not aware of any industry resistance to Cocoapods, so I don't see a downside to supporting it, and it does solve the problem you're talking about (albeit in a roundabout sort of way).
Also I've found Chartboost VERY developer-friendly. You might even reach out to them and ask.