Detect Which Files Changed with Dropbox Sync API - dropbox-api

I am detecting file changes via the Dropbox Sync API (iOS) like this:
[[DBFilesystem sharedFilesystem] addObserver:self forPathAndDescendants:[DBPath root] block:^() {
NSLog(#"File(s) changed!");
}];
This is all fine and good, but I need to know which files changed. How can I make this block return the filenames of the changed files?
Thanks!

There isn't any support for this, but we've definitely heard this feature request before.

Related

iCloud - Moving the file completed

I can able to move a file from the local directory to iCloud using the condition setUbiquitous:YES. The file has been moved successfully. If the file size is large, it takes certain time to complete moving. Is there any method to identify, if the file has completed moving to iCloud? Thanks in advance for your answers.
Note: I haven't done this myself, so all the info below is purely from reading the documentation:
The NSMetadataItem class has, among others, an attribute key called NSMetadataUbiquitousItemIsUploadedKey. Knowing this, you should be able to set up an NSMetadataQuery that notifies you once the item has been uploaded.
You can check with NSUURL getResourceValue:forKey:error: method
NSURLUbiquitousItemIsUploadedKey—Indicates that locally made changes were successfully uploaded to the iCloud server.
NSURLUbiquitousItemIsUploadingKey—Indicates that locally made changes are being uploaded to the iCloud server now.
NSURLUbiquitousItemPercentUploadedKey—For an item being uploaded, indicates what percentage of the changes have already been uploaded to the server.
For details: https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/iCloud/iCloud.html#//apple_ref/doc/uid/TP40007072-CH5-SW1

Accessing files in Documents folder via jqtouch in iphone app

I was able to save some files in the Documents folder on my app. How can I access them on the phonegap side of things with jqtouch/javascript/html. I want to do something like:
$('#intro').attr('src','../../Documents/logo.png');
But, apparently, it's not letting me go up all those directories outside of www.
How can I resolve this?
There is a bundle file reader plugin, but it seems to read the contents, not reference it.
https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/BundleFileReader
Not sure you can do what you are asking about. Perhaps you could use the PhoneGap File API to save the files somewhere within your www dir instead? Then they would be available via html/js.

Retrieving updated files from server to replace files on documents folder of an iPhone

Im new to iPhone programming and wanted to see how people have solved this problem:
Ive created my app which will ship with certain pLists and .png files in the main bundle. However, what I want to do is when the app starts up, Id like it to check my server to see if there are updated versions of the files in the documents folder available. If so Id like the app to download those files.
I was wondering if someone can point me to some resources on how to do this? Ive searched online but haven't come up with good hits.
Whats the google key-word for searching this topic anyways?
Thanks a lot
you can use NSUrlRequest to download the files, to move them to the correct place you can use NSFileManager, if you look at the apple docs for both these classes there should be sample code explaining how to copy/save a file from NSData, and also how to download it.
I don't have any example resources of how to do exactly this, though I would probably do something along the lines of onAppLoad checking to see if the content of the application that you want to keep updated is the most recent, and if not, download it.
As for keywords to search I would try something along the lines of "Automatic App Content Updating/Verification" and throw in "iOS/iPhone/iPad" or some similar combination.
I'll do some more poking around and shoot you a comment notification if I find anything worthwhile, and then edit my post with it.

How to detect FTP file transfer completion?

I am writing a script that polls an FTP site for files and downloads them locally as and when available. The files are deposited to the FTP site randomly by various source parties. I need a way to be able to detect if the file on the FTP site has been transferred over completely by the source party, before downloading them. Any thoughts on how to go about this?
If you have control over the client, a much safer, cleaner and efficient way is to have the client do the following:
Upload the file to ..../partial/somefile
Rename ..../partial/somefile to ..../complete/somefile
This causes the file to appear in the latter directory all at once, so all you have to do is scan that directory. You could even ask the OS to be notified of additions to that directory if you wanted a non-polling solution.
If you cannot manipulate the FTP server itself the only way of checking that comes to my mind is polling the filesize and if the filesize doesn't change for a longer time you can be quite sure the upload has finished. But nobody can guarantee. Ideally you can adapt the FTP server and make it execute some script after finishing some upload.
Some pseudo-code:
my %filesizes;
my %processed;
sub poll {
foreach (#files_on_ftp) {
if($_->filesize == $filesizes{$_->filename} and not $processed{$_->filename}) {
process($_);
$processed{$_->filename)++;
}
}
}
Like ikegami's solution depends mine of client side:
first is file uploaded
if it is completed, client uploads empty flag-file (like file.name.txt.finished)
When you see finished-file, you know file is ready.

Uploading and downloading via ftp with iPhone SDK

Could anybody explain to me the process of uploading to and downloading form and ftp server with the iPhone SDK. If you could just point me in the right direction (e.g. documentation etc.). How difficult is a task like this?
Thanks in advance.
You can use this. It support all the basic ftp operations:
Download file
Upload file
Delete file
Delete directory
Create directory
List directory contents
[DISCLAIMER] I am the developer of the library, I needed a ftp library too in the past and came over this answer. However, I decided to write one myself because s7ftprequest didn't support at that point several operations that I needed.(like download or list directory)
Try this Simple FTP Download
The Apple documentation will provide far more info in general than I could. Have a look at:
http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html#//apple_ref/doc/uid/TP30001132-CH9-SW1
which details the FTP information you need. If you prefer a PDF with all the networking info in it, have a look at:
http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/CFNetwork.pdf
In this, you'll be particularly interested in Chapter 5. Both detail working with FTP sites, including uploading, downloading, retrieving directory listings, etc.
s7ftprequest only for uploading files to FTP.
The below is sample code from apple
http://developer.apple.com/library/ios/#samplecode/SimpleFTPSample/Introduction/Intro.html
Limitations:
FTPS (that is, FTP over TLS)
deleting items
renaming items
other less common FTP commands
custom FTP commands
I ended up using GoldRacoon. It turns out that in iOS/objc land, there's BlackRaccoon as the original FTP client lib, then WhiteRaccoon was forked from that, and then GoldRacoon was forked from WhiteRaccoon (I think)
pod search GoldRaccoon
... will show you.
I ended up making a few changes (in my own fork) so that you can pass in a successBlock & failBlock into any request, so that block-y callers (like my classes) don't have extra work to manage the delegate callbacks. Github link (my fork): https://github.com/xaphod/GoldRaccoon