Archive format suggestions for exporting iPad app data? Tarball? - ipad

I have an nascent iPad application, which stores "documents" internally on the device in the file system as a series of distinct files in a folder.
I'd like to try incorporating an import/export function through iTunes, using the features for OS 3.2 for this. I want to put all the document pieces that I keep internally into one container file for export.
So, smart folks of Stack Overflow: What's the simplest solution that will put a file hierarchy (or could be flat list in a pinch) into one file? There will not in theory need to be manipulation of the "archive"/container outside the app-- so random access isn't super important here, although it would be a bonus of course.
A tar file type thing springs to mind immediately. Roll my own? Any other thoughts or gotchas? (And if anyone can point me to code that reads/writes from a tar file, I'm all ears.)
Thanks!
Update: Made community wiki, since there's no single right answer here.

Try libarchive which is a friendly licensed, BSD derived (easier for iPhone OS) library for handling archive files.

Related

Pre-load content into Documents or Library directories from XCode

I am building an iPhone app that requires preloaded content. This content is presented so that it tests the user's knowledge, but is not modified by the user. The content consists of proprietary image files and pdf files.
From what I understand, the best practice would be to store this in the app's Library or Documents directories (please inform if this assumption is not correct). In a future version of the app I might want to upload additional (not replacement) content via API, but this is not part of the initial version.
I have seen many posts and tutorials regarding obtaining paths to the Documents and Library directories of an app, and reading/writing to them. This is all good and useful, but not what I am looking for here.
I would like to preload the content into the Documents and/or Library directories, for the simulator initially, to test app in simulator; and ultimately to the release version. I would have thought this would be possible to do from XCode without writing code.
I have not been able to find a solution to this on Stack Overflow or other places on the net. Any pointers, links, solutions are welcome. I am using XCode 10.3 with Swift 4.2.
See the File System Programming Guide: File System Basics, which shows us:
The “data container” (including the Documents and the various Library folders) is for content generated/saved by the app. When, in Xcode, you mark resources as being part of the target, that becomes part of the bundle, and your app can retrieve it from there at runtime.
Theoretically, yes, you could copy data from the bundle to the Documents and/or Library folders, but, yes, you would have do that programmatically. It seems a bit wasteful to have two copies of these resources on the device, but you can do whatever you want. Generally, though, resources included in the bundle would just be be opened directly from there at runtime, not copying it to the data container (except for those cases where you would need to change it, because bundle contents are read-only).
FYI, for additional information regarding the file system, see the iOS Storage Best Practices video.

Steps to develop an iOS app to open PSL files?

In this project I've to develop an iOS application which reads the .psl files and arranges the data in the relevant section. For eg: the inbox messages from the psl file into the app's inbox folder and so on.
Can anyone guide me regarding the steps? And how would my project proceed also tell the workflow of this whole process.
The first thing you're going to have to tackle is to figure out how to get the file onto the phone. If you're getting it from the web; you could register as a sharable-target for that file type, or you could potentially integrate the DropBox api or something similar.
Once you have the file; you'll have to develop something to parse the file and use it as a datafile. Depending on the size and complexity of the file there will be different possible approaches to this, and you'll need to figure out what's going to be performant for you.
Then you'll build view controllers that leverage your model and make awesome things happen on the phone.
Your question is extremely general; so this is a very general answer. To me; the immediate critical questions are: how to get the file to the phone; and how to read the file format without loading the whole thing into RAM at one time?

Cocos 2D GUI & Xcode 5

I have an iOS game app that was created in Cocos 2D & Box 2D by an outside developer where I need to make some minor UI modifications (nudging platforms, item positions, etc.).
Normally, to get a visual view of the app in previous versions of Xcode, you would go to the .xib file. In Xcode 5 this is supposedly replaced with main.storyboard. Though I can build & run my project in the simulator or as an .iap file on my device, I cannot figure out how to make corrections to graphics (re positioning) as I would normally do. The main.storyboard file doesn't exist in my project.
Current file extensions represented:
.h, .mm, .cpp, .cmake, .pch
Thanks in advance.
Most cocos2d apps position "graphics" in code. Storyboard and xib files are not used at all for visual layout of cocos2d elements (nodes).
At best you'll find ccb or ccbi files which would indicate that CocosBuilder was used to design the scene's layouts. If there are no such files, you have to look into and modify the code.
If it was created in cocos2d/box2d, there are any number of ways that the presentation could have been created. Usually these don't involve storyboard/.xib files for cocos2d/box2d.
All the files you listed are standard code files; I don't see any graphics files (.png, .pvr, etc.) or physics editor files (.pes) in your list, or CocosBuilder files (ccb/ccbi). There are probably more file extensions in your project that you may want to find. You could potentially list out all the file extensions in your project, and maybe somebody on SO will be able to help you identify the tool or tweak the code by posting it.
However, I think the best option is to find a developer familiar with these technologies, let them take a look at the code, and get you back on track.
You may type a lot into SO and wait a long time for an answer to something a good developer could find for you in a few hours. If this is an academic (no commercial project), they may do it for free. Or for a nominal fee for a commercial project. Or for good will. Or the fun of it. etc.

How can I update a file incrementally in iOS. (File patching)

I have a huge text file in my application (version 1.0).
Lets assume that a new version (2.0) of this file was just released.
Most of the file remained the same but the new (2.0) version has a few modifications (some lines removed, others added).
I now wish to update the file (1.0) to the new version (2.0), but do not wish to download the whole file again.
I would love to just patch the file with the changes of the new file, thus saving bandwith from downloading the WHOLE new file from my server.
(Similar to the way versioning systems like git or svn act)
How can I do this programmatically? Are there any iOS libraries available?
Thank you
You need to implement some kind of Binary delta compression such as zdelta, or Remote Differential Compression such as the one in rsync.
Personally I'm not aware of such algorithm implemented specifically for iOS, but I'm sure it's possible to find one that is implemented in C/C++ which can be seamlessly used in the iOS environment.
Edit: I also recommend you to read this.
It's actually a big problem... if your API let you ask the data of a file in a specific range, you can just a ask the data range that you need to replace, and seek the file at the range and overwrite the specific data... this mean that you have to take trace about the changes every time you update the files... and your app update has to know the ranges to request... this is not a solution... I hope will be a start point to implement your own solution
to try to get partial conent in a range you need to add to your request header something like this:
Range: bytes=0-999
I think, you can do this by yourself without third party libraries. To achieve this, all you need is 1)Piece of code which will generate the metadata for joining versions of your file (offsets, lengths, and pointers to the data to be changed in older version); 2)piece of code which will do the hard work: read meta and put the parts on right places. Several days of struggling with offsets, and you are done ;) Good luck!

BlackBerry - Unpack Zip File

I'm developing a BlackBerry application in which I need to unpack a zip file compressed with PKZIP. The package could have one file in it, or it could have 10; it will vary in each case. I know that the BlackBerry API has native support for GZip and Zlib, although I'm pretty sure that these methods aren't going to be helpful in my case. It doesn't look as if I can extract the individual files using these calls.
I've tried JZlib (http://www.jcraft.com/jzlib/), which compiled fine, but again it doesn't look as if the methods contained therein are going to allow me to pull the individual files.
It appears as if this is possible, as there's an application called Ziplorer (http://www.s4bb.com/software/ziplorer/) that claims to do perform this exact procedure. How they're doing it, however, escapes me.
So here I am after hours of Googling. I'm welcoming any insight into my problem with open arms.
"zip" algorithms are typically offshoots of the Lempel-Ziv-Welch algorithm. They are a fairly efficient stream compression algorithms, but because of how they function, you can't start to decompress at random points in the file, you have to start from the start.
Any product that claims to be able to decompress one file from a zip still has to decompress everything before it in the zip file in order to know how to decrypt the given file, or even, for that matter, where the file is in the archive.
If you can tolerate GPL code in your application, then this library http://jazzme.sourceforge.net/ that might work. However the project (and its parent project http://sourceforge.net/projects/jazzlib/) don't look like they're being developed.

Resources