Monitoring if File is currently open Mac App - objective-c

My app create a file on the FS and opens the file in other application(s). I want to monitor the file for changes which I already have in place, but I also want to know when the other application has closed the file. Is there some API that currently exists on mac, and it's an API that will not get my app rejected from the app store ?

I believe the thing you're looking for is in FSEvents (File System Events), specifically the FSEventStreamCreate function with the FSEventStreamEventFlag kFSEventStreamEventFlagItemModified.
As long as it's a file within the user's sandbox (or one that the user has given permission to use), I would think you should be okay for the app store.
More information can be found in this related question.

Related

Open a downloaded file with a third party application

I have an application that allows users to download files from the server, these files can be pretty much anything.
I am at the point where a user is able to download a file to their phone but I can not figure out how to allow the user to open the files from the app, for example say a user has download a word file (.docx), when they select the file in my application I want the file to either open in the default .docx viewer or present the user with applications that can open the file. (Similar to how WhatsApp handles it)
I have tried using Linking.openURL('file:///pathtofile/filename.docx') but I get an error saying Could not open URL file:///pathtofile/filename.docx, exposed beyond app through Intent.getData()
I'm currently using Expo and would much prefer not to have to detach my app.
Update:
I ended up detaching from Expo and built native modules to handle this.

Filelauncher save files

Let's say i have a list of files. When I click on one it will get downloaded and saved into the app's isostore. Then it's opened in the default viewer/editor on the windows phone like this:
Windows.System.Launcher.LaunchFileAsync(file);
But when I make some changes to the file and want to save it, it can't, because it's a read-only copy of the file. Is there some way to get write-access to the file or else some public/shared (iso)store that every app has access to? The goal is to download the file, edit it and upload it back to the server.
Per the Windows Phone documentation, the Windows.System.Launcher.LaunchFileAsync API is not implemented for the Windows Phone platform:
Windows Phone 8: This API is not implemented and will throw an
exception if called.
In regards to saving the file so that it can be accessed by other applications, this is not possible, unless the file you are dealing with is a photo, in which case you could use the Media Library API.

WP push files to device over company app

With a company App configured on a Windows phone there is the posibiltiy to push the installation of an App. When the user starts the pushed App some configuration data must be introduced. I would like to save the user this step but I still don't know how. Isn't it possible to push files over the company App/Exchange, as it is on a Windows machine? So I could read the configuration out of this file.
your use case does raise many questions (probably just terminology)
The only way to push an APP to a device is through the Windows Phone store or website.
If you want to push configuration to a device for an app then the app must be run at least once to enable that ability and you could then use a background task to periodically check for new configuration and download it.
The other thing you can investigate is push notifications but they are not really meant for pushing data, you can sent simple objects or data to the device as a raw push but the app must be running first.
The most common way to achieve what you describe is to have the app load config at launch, locally first and then update it from a web call (if web is available, as these are mobile devices you can not guarantee connectivity). We do something very similar with AdRotator where we try to download config at start and if that fails use a locally cached version.
As of WP 8.0 there isn't the possibility to push Apps or Files through the company App.

Monitor changes made by a desktop app to a file created by my Windows Store app

I'm making a Windows Store app that gets files from a server and store it locally for quick access. I also want to make it sync the file with Dropbox and push changes to Dropbox if the user make any. I looked into CachedFileUpdater and it seems to work if I use another Windows Store app to edit the file. However I ran into a great trouble trying to monitor changes made by a desktop app. This matters a lot because many files are office documents and Office 2013 is available to Windows RT and I would also like the app to be available to Windows 8.
First I tried to use CachedFileUpdater on all files but when I open the file using a desktop app, it will be opened in read-only mode and I can't save it in desktop mode. If I dont use it if the user chooses to open it with desktop app, the change will be saved but later my app won't be able to access that file somehow. I guess it is because the owner changes to the desktop app. Now not only I seem to have no way to monitor the file changes, but also can't I access those changes once it is modified by a desktop app.\
Is there some trick that may help? Thank you very much!

Transfer/Copy files from one iPad app to another iPad app for Editing

I am wondering if there is a way in objective c to have my iPad app copy a file in it's documents folder to another app's documents folder and have that app open the file for editing and finally copy the file back to my documents folder. Or better yet, can I have another app open a file from my documents folder, edit the file, and save it back to my documents folder?
So far I know I can have another app open a file in my documents folder but the app that I'm handing the document off to seems to be making a local copy and editing the copy. I also know that each app's document folder is a shared folder that users can drag and drop stuff from itunes but I'm not sure if the same can be done in code.
I am pretty sure what you are trying to do is impossible. iOS applications are "sandboxed" which means that each app has its own documents directory. No application has access to the file system outside its own "sandbox" i.e. outside its own local documents directory.
For more on the iOS application sandbox, Read here.
Though a sandbox exists, I found a way to work around it (it's a trick being used by other File Manager apps like GoAruna). I would first register my app as an app that can open the type of files that I plan to work with. Then I use the Open In functionality to have my users open up my apps local documents in the second app, an app like iAnnotate. Then, because my app is registered as an app that can open the current file type, I can instruct my users to use Open In from iAnnotate to move the modified document back to my app. Sorry but I could not accept "no" as an answer. If anyone is interested in this approach, go here
If your iPad is jail broken, try this:
On the app iFile, type in the document name in the search box located at the top. Once you find the document, click on it and options would be showed to you. From here you can choose the app you want to open the file with.
Hope this helps.