I know it is possible to access the gallery photos and pick them as UIImage using UIImagePickerController, but I want to know whether all other files like doc, txt, pdf etc can be accessed from device please help.
thanks
You can, but there's no built-in picker like there is for images. Take a look at the NSFileManager class for enumerating directories and working with files.
There is no GUI API to access the file system, you can create your own UI and read and write from your app's documents folder though.
There is no universal space to store that document in iphone like photos and videos. but you can store in your app and and using itunes file sharing you can access it.
here is the way to enable itunes file sharing.
you can store in icloud and access it from app.
Select your project in top left
Select target in next column
Click on Info tab
In Custom iOS Target Properties, hover mouse over any row and click +
In popup, select "Application supports iTunes file sharing", then set Value to YES on right
Click Validate Settings at bottom to make sure all is good
Related
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.
I am a newbie to iOS, I have a created a textfield and imageView in a ViewController. I want user of app to select an image or a file(.txt,.csv, etc)into the App. I know that Apple provides UIImagePicker to select images from the device. with these I added an image to my imageView.
Now I want to Know that is there any way to select files from the device and use it into application. Or else Open file system of device and select the file ?
When I Googled it, I got that you are not able to open the file system. So how can I implement this functionality in iOS app?
There is no way of selecting file from file system into application. You can only access files from
Default Photos App
Application Documents Directory
Any file from web server with use of API's
There are multiple ways from which you can select files of different types other than images are
Integrate Dropbox SDK into app
Integrate Google Drive
Integrate iCloud
So create one UIButton like "Select File" and open UIActionSheet on tap of it. UIActionSheet will have options like
Select From Photos
Select File From Dropbox
Select File From iCloud
Select File From Google Drive
etc
And you can call respective actions on each index.
You can pick your documents and images and other files by using separator picker for each like
for Documents - UIDocumentPickerViewController
for Images/Videos - UIImagePickerController
Apple does not provide a direct picker for all files.
Hope this is working for you. :)
You can use UIDocumentPickerViewController if you enable iCloud document support for your app.
you can not load files directly from file system, but you can load them from some third party applications like Documents and cloud sources like iCloud and Drop Box with UIDocumentPickerViewController
Background
I have a dictionary with more than 100 keys that I've stored in a property list that I can transfer/load/save to from one Xcode project to another.
Research
I've looked at several posts on StackOverflow but most of them seem to deal with loading a plist from the main bundle, copying it to the Documents directory and loading/saving it from there with no way of retrieving it to use in other projects.
TLDR
I want to be able to 'export' a plist created programmatically as a separate file I can use in other projects unrelated to the current one.
Update
Thanks to #NSNoob I've figured out that I can manually access the new plist from the Documents directory. Now the question is, how? Isn't iOS sandboxed without access to the filesystem unless it's jailbroken?
You can get Documents directory contents of your app like following:
Connect your device to your mac
Open your Xcode
Click on Window and select Devices
Click on your device
Search for your app in installed apps list
Click on your app
Click on gear icon
Click on Download Container.
Right Click on Saved xcappdata file.
Click on Show package contents.
That will open your documents directory and you will be able to find your modified plist there.
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.
I am working on an app right now that is supposed to generate a text document from an NSString , save it to the app's documents foldr, and then upload it to the iCloud.
I want to check and see if the file is actually being created and saved in the Documents folder in my app's Sandbox.
How do you look at the files saved on an iPhone? (Either on the phone
or when it is connected via USB to my Mac.)
This is just for testing purposes and all I want to do is view the file name and contents, not edit them in any way.
In addition to pdesantis's answer, you can achieve what you want through Xcode rather than relying on third-party tools. Open the Organiser, select the Devices tab, select Applications under the relevant device in the column on the left, then select the app you're interested in in the large area on the right and click Download at the bottom of the screen to grab its current local storage.
Try this
http://www.macroplant.com/iexplorer/