Is there a way to open an editor app in ios and receive edited results? - ios

I have an app that downloads files from a web server. Our customer wants the ability to edit those files on their mobile devices and upload the edited version to our servers. Is this possible in iOS? I have figured out how to allow users to view the files in external apps, but I don't see a way to bring back their changes if the file was modified as it seems to copy the file into the other app's space, so my app is left with the unaltered version.

iOS has a sandbox mechanism, so for sure you can not modify any file in another app.
The only way to transfer data from different app is using sharing.
This is a sample project I wrote for implement sharing on iOS, check it:
Sample for sharing on iOS
Hope it can help you.

Related

Create a file through a Cordova/Phonegap app that can be opened by another app (ios)?

I'm able to create and save files using cordova-plugin-file, and have been saving and accessing them from within the app to cordova.file.documentsDirectory.
The problem it seems is that all the directories that one can save to are private, Cordova-plugin-file documentation
I would like to be able to have these files saved in (or moved to) the ios blue "files" folder, so that they can be opened by other apps such as Numbers, Pages, etc. It seems so simple there has to be a way to do this, but I can't find it after more than a few evenings of searching and trying different ways.
I'd be grateful if someone could point me in the right direction.
From what I can tell you can save to the documents directory "cordova.file.documentsDirectory". By default this directory is shared with iCloud, so a file saved here could be opened through the ios File folder and a user could then select the files and hit the share icon to open with the appropriate app, such as Numbers etc.
In order to turn on iCloud you have to pay the developer fee to Apple and select the options to do so. I found the article "Working with the Files App in iOS 11" to be helpful in starting this process.
I don't have the paid developer account yet, but from what I'm reading it should work once I activate one. I'm open to a better solution or critique.

iOS, config files and sandboxing

My understanding is that because of sandboxing, it isn't possible to view any text file (ie config file) associated with an iOS app using another app. Something quite simple with Android. Am I mistaken?
I am trying to implement a text config file with a Unity iOS app that gets loaded and parsed once when the application boots.
This config file would also be able to be edited and saved manually on that actual iOS device.
(addendum)
In Unity there is PersistentDataPath which resolves to /var/mobile/Container/Data/Application/foo/Documents
Is there an iOS supported file explorer app that will allow me view and edit files in this location (without jailbreaking)?
Use can check iOS App Groups. It allows multiple apps access to shared containers and allow interprocess communication. There is no so much documentation about this, but maybe that's what you're looking for. At least you can share NSUserDefaults between the apps.
NSUserDefaults it's a most simple way to save any (not big) configurations for your app. For manual editing: if your app on the device signed with developer certificate, you can connect through any iOS supported file explorer app and edit it. But after release, from App Store, your app installed in restricted/private path, so it's not possible, if only you don't have a jailbreak.
Initial configuration you can put into your app bundle, and at the first run just copy them to NSUserDefaults.
Short answer: There are utilities such as iExplorer - https://macroplant.com - that allow "file manager" type access. However...
Long answer: If your app requires users to buy (or get) other software to modify configuration files, the chances of Apple approving it are slim to none.
The appropriate thing to do is to provide a User Interface in your own app which allows the user to modify / update the settings.

ios copy file to another apps file directory

Is there anyone that got an idea of how to copy files to another apps file directory in ios? I need a service for this so I can from my app simply hit a button and what my app does is copy a file to another apps directory? will that be possible? I am ready to pay for a person that can help me with this?
iOS apps are sandboxed and are not able to directly access the contents of another app's data. There are ways for apps to interact with each other, but these require user interaction and are limited to specific use cases. For more info, here are some docs from Apple on inter-app communication:
Document Interaction Programming Topics for iOS
Inter-App Communication

Writing to a file in my iOS app

I have an app that downloads files that need to be edited and submitted back to the server through the app. These files could be anything, but are most likely to be .docs. I want to be able to open and edit these files in another app on the device, such as a .doc editor.
I've been able to get this functionality to work in similar Android and Chrome apps, but I'm very new to iOS so I'm not sure what my options are.
Is there a way to give permission for another app to edit a file that is in my app's sandbox? If not, is there a way to get the file back for submittal (like finding it through a file explorer launched through my app - similar to an 'Open..." file explorer dialog used in Windows/Mac OS/Chrome)? Am I going to have to create a way for the editor app to share the edited file back to my app?
Thanks in advance for your help!
To manage the file and the paths take a look at the documentation for NSFileManager:
https://developer.apple.com/LIBRARY/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
I usually write using NSFileHandle for reading and writing:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileHandle_Class/Reference/Reference.html
Hope this helps.
iOS8 will provide methods to allow apps to co-operate with "extensions".
See "Creating Extensions for iOS and OS X, Part 1 & 2` in the WWDC14 videos.
Also see the Apple "App Extension Programming Guide".
I ended up sending the file to a 3rd party app for editing and then sending the file back from the 3rd app to my app.

Retrieve File from User's Documents Directory

I can successfully read and write a text file within the user's Documents directory for my iOS app. However, I will need to view this text file myself, retrieving it from the user's iPad.
I looked into sending it via email, but all of the links pointed me to MFMailComposer rather than some automated way of sending email. I looked into FTP uploading, but Apple doesn't seem to want me to use password protected FTP in my app. How can I go about making a text file in the user's Documents directory accessible from my own computer? I feel as if there must be some easier options for this task.
Well, there's iTunes File Sharing. It is probably the most "direct" way to do it, as it doesn't require any 3rd party service and frameworks. Read more about it at Ray Wenderlich's - the tutorial is a bit dated, but should still be valid for the most part.
For over the air sharing, I'd recommend dropbox. It is easy to use within your app and many of your future users will have an account already.
Lastly, if you require the functionality for your development purposes, you might want to take a look at iExplorer (formerly iPhone Explorer). It will allow you direct access to your apps documents folder and doesn't require you to alter your app in any way to work.
Go to your App-Info.plist and add a row under Information Property List.
Name that row Application supports iTunes file sharing. You should see it auto completing.
Set the value to YES
That's all you need to do. Now you can access the files from your iTunes.
As of August 4, 2014, open up iTunes. In the top right corner, click on your device, but NOT the eject button. It might say iPhone. Click on the Apps tab and scroll to the bottom to File Sharing. Click on the desired app and the documents will appear.

Resources