How to unzip a zip file shared through iTunes from the Application Programmatically? - iphone

I need to unzip file synced through itunes in the documents directory programmatically. There are open source frameworks available like ZipArchive and ZipKit but I am not able to use them in the project. Is there a decent tutorial where I can see how to use these frameworks.

you can use SSZipArchive.
It is so simple way to unzip file. please read Readme.markdown (usage).
Simple three lines and that's it.

For ZipKit, you need to use the Better Way of Installing the Framework and follow the Static Library section of the ZipKit Documentation because iOS doesn't allow you to use to embed the Frameworks directly. You need to include it as a Static Library.
Alternatively you could use something lightweight like iZip

Related

Use .mdb file instead of SQLite in iOS app ?

How can I use the .mdb file instead of SQLite, I am working on a project that will load and update data from .mdb file. I search about it but can't found anything can you poeple guide me.
MDB Tools is an opensource project that aims to bring support of the prorpietary MDB file format of Microsoft Access to POSIX systems. Since it's written in pure C, it should be fairly easy to integrate this project in your iOS app. (You should specifically be looking at its libmdb part.)
.mdb is not supported with iOS API. You should convert your .mdb file into sqlite file to access through iOS API.

How to build a static library of an existing project in objective-c (.a file)?

I want to make .a file means static library of my project which I have made. How can I achieve this. Please provide me the the best solution, tutorial or any other links.
Thanks in advance
http://mobileorchard.com/sharing-compiled-code-building-static-libraries-in-xcode-for-the-iphone/ has a good tutorial.
Here are the basic steps:
Understand that XIB/NIB/Storyboard files have to be included separately from the library
Add a new target that is a static library
In the build settings for that library, include all of the .h and .m files that are relevant. For example, if your app uses a set of classes to access data and another set to view that data, you may want to just include the files relevant to accessing data.
Build. Use the script provided at Build fat static library (device + simulator) using Xcode and SDK 4+ so that you can use it for iPhone simulator + device.
Include your library + headers + any resources in relevant project.
With xcode4.2, easiest way is to new project, iOS/Framework & Library, CocoaTouch Static Library, and add all you files existed.
Here is the easiest tutorial with which i have built a static library in iphone. After building a static library you will import a .a library file and the header file .h in your new project and use them. Here is the tutorial link for making static library.

Acceptable library to extract .Tar files for an iphone application

please help me to understand that which library will be the best to extract .tar files in an iphone application.
on googling i have found in few posts that libacrchive can be used but another posts says that it will be problematic if you go to upload your app on App store.
Please suggest a suitable library for this purpose.
I write a lib exactly for that: extracting standard tar file without zlib compression.
https://github.com/mhausherr/Light-Untar-for-iOS
My lib take just few lines when libarchive heights 4.7Mb.
Full explanation here: http://blog.octo.com/en/untar-on-ios-the-pragmatic-way/

Converting Framework to a Library

I want to use the framework found at the link below within an iOS app. I have it working within the simulator but after some digging it looks like you are unable to use frameworks on devices and especially when distributing through the App Store. Please correct me if I am wrong.
https://github.com/mirek/YAML.framework/
How would I go about converting this framework to a library? I have looked at simply dragging the files from the framework to the app which doesn't work.
Thanks in advance.
It's super easy.
Give the general iOS static framework structure:
3rdPartyLib.framework
|---3rdPartyLib -> Versions/Current/3rdPartyLib
|---Headers
|---Resources
|---Info.plist
|---SomeBundle.bundle
|---Versions
|---A
|---Current -> ./A
You have to
1) Copy the static library file in a new folder
3rdPartyLib.framework/Versions/Current/3rdPartyLib
2) Rename is with .a extension and copy to a new folder
3rdPartyLib/
|---3rdPartyLib.a
3) Copy all the headers in the folder
3rdPartyLib.framework/Headers
in a new headers folder in the new folder
3rdPartyLib/
|---Headers/
At this point you should end up with
3rdPartyLib/
|---3rdPartyLib.a
|---Headers/
This is your static library that you can use within your app or within another iOS framework to be distributed to other apps.
Take a look at this: https://github.com/Ecarrion/YAML.IOS
Just grab the YAML.Framework folder
And you actually can use framework, you just can't use dynamic libraries.

Select a file on an iPhone

I want the user to select a file from an iPhone and upload to an HTTP server.
Example: The GoodReader application has this feature in it.
How can this be done?
You can't get all the files stored on the phone.
As the comment from Stephen Darlington states, your app is sandboxed and can only get to the files stored inside your app.
You could register your app to be able to open PDF, txt, doc and other files that you are interested in sending to your server and then users would be able to open these documents in your app. Once the files are inside your app you could then use any number of ways to upload them.
Please read the documentation here about registering your app to understand file types:
Registering the File Types Your App Supports
The file list would just be a UITableView, probably with a custom UITableViewCell.
There are a number of options for uploading data to a web service. The built-in way would be to use NSURLConnection. There are some open source frameworks that may be able to help but I have not used them.
The best way that I've found to upload images is to use the ASIHTTPRequest API. Here is a link on the documentation on POSTING data to a server. Download ASIHTTPRequest here and these are the setup instructions.
How to select a file depends on what kind of file you're trying to select. If you're trying to upload images you should look into a UIImagePickerController and UIImagePickerControllerDelegate. If not, you'll have to create a NSFileManager to search through your application's files.
NSFileManager Class reference:
http://developer.apple.com/iphone/library/documentation/cocoa/reference/foundation/Classes/NSFileManager_Class/Reference/Reference.html
Discovering Directory Contents:
– mountedVolumeURLsIncludingResourceValuesForKeys:options:
– contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:
– contentsOfDirectoryAtPath:error:
– enumeratorAtPath:
– enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:
– subpathsAtPath:
– subpathsOfDirectoryAtPath:error: