Uploading files from iOS Files app in another app - swift

I'm looking to add functionality to my app that would allow a user to upload a file within my app from the Files app that was introduced in iOS 11. I would expect that it would work the same way that existing components do now where you can select Upload a Photo or Video on your iOS device and it allows you to select items from within the Photos app. I have been searching and I have not been able to figure out a way to do this. I know Apple's Mail app has this functionality (under "Add Attachment"), but I have not found a way to surface this functionality in my own app.
Since I am using Eureka for my other row inputs, it would be ideal to have this in an Eureka component but right now I am just trying to figure out if it is even possible to select files from the Files app from another app with Apple's existing APIs.

The Framework you are looking for is built in to UIKit in a class called UIDocumentPickerViewController

Related

How do I allow a user to browse/choose a file from device in iOS

I want to allow the user to upload the files in my iOS application just like the way we upload a particular file in desktop applications with browsing through the different directories. I did some googling too, but did not find the reliable solution.
Someone says that.
The whole file system is not available, if you're running a non-jailbroken phone. Neither are there filesystem browser controls (for the same reason), However, you can browse the user's photo library, or even take a photo with the camera using UIImagePickerController.
Some questions were like this
Is iOS developer able to view file systeme
How to list all folders and their subdirectories/files in iPhone SDK
From these links and from other sources,
I am only confused that can i provide the file browse option to user on button tap. And if yes, then how it can be achieved? Any help will be appreciated.
If the user taps on the Browse button the list should be there like
iPhone apps are sandboxed. This means that you can only access files/folders inside your AppBundle (like Documents, Cache and the like). That is what the above mentioned URLs are suggesting. You can only upload/download data from/to these folders.
Now if you have a jailbroken phone, its a different scenario. Not going into that.
Check this link out:
Apple iOS Environment under that The App Sandbox
There is no standard control for this purpose, but using the methods mentioned in the posts you referenced, populating a table view is perfectly doable. Keep in mind that this will allow you to view the files in your application's sandbox. You cannot access files of other applications.
Alternatively, you can use open source libraries like the ios_file_browser or the iOS-File-Browser. These provide user interface and you can check out the implementation as well.
Starting in iOS 8, you can use UIDocumentPickerViewController, "a view controller that provides access to documents or destinations outside your app’s sandbox":
https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller
I'm an author of FileExplorer control which is a file browser for iOS. It allows you to browse files and directories that are placed inside your sandbox in a user-friendly way.
Here are some of the features of my control:
Possibility to choose files or/and directories if there is a need for that
Possiblity to remove files or/and directories if there is a need for that
Built-in search functionality
View Audio, Video, Image and PDF files.
Possibility to add support for any file type.
You can find my control here.

Is it possible for a web based app to retrive images from an iphone?

I'm creating a website which I would like to be supported on the iphone as well. The site allows users to upload images and manipulate them. On a desktop the user will simply click the upload button to select the file from their computer and upload it to the site. But this will fail on an iphone.
Is there any way for a pure web app which is using php/mysql/js and runs inside the browser to get images from a user's camera roll? Does Apple offer any APIs to make this possible?
No, it's not possible currently - but apparently iOS 6 is going to support image and video uploads from MobileSafari.
(Apart from that, you can ask your users if their device is jailbroken and id so, suggest them downloading Safari Upload Enabler from Cydia).

Import possibility from iPhone App to native Calendar

So I have this iPhone app, working a lot with my webserver (PHP) and getting data from there, mostly HTML content. In this app you can see a list of events (with date, hour etc). Now my users asked me if they could include it to their native iPhone calendar.
Is that possible, and if yes, how?
Do I need to update my application for that or is it possible to generate a file at the server side which the users simply can download? I kinda hoped I could do it that way.
Try using the EventKit framework: http://developer.apple.com/library/ios/#documentation/EventKit/Reference/EventKitFrameworkRef/_index.htmlLike explained here: Programmatically add custom event in the iPhone Calendar

iPhone: Access Camera and Album from Web app

I want to develop a web app using html5, js. One of the feature is to launch device Camera and record video, take a picture and access photo album. Is it possible to access via web app if i develop? I saw in the forums that, it is saying not possible in some places and it is possible in some places. I would like to know, is it really possible to access directly camera and album etc. ?
Please suggest!
Thank you!
It's not possible to access phone camera using Web app, as the "Web APP" typically runs in the browser of device.
Though there are some frameworks (like Phonegap) allows you to embedd your web app into native container. With this approach and added libraries from such framework you can access some of those native API's and Device Hardware.
One Possible solution is,
Create one app and distribute it using app store
using your webapp, you can connect to above app using url-scheme
http://code.google.com/p/iphone-photo-picker/
go to above link, where you can find complete code for it.

Phonegap WEB-APP without xCode

I'm building a simple web app for iOS that will not be published to the AppStore.
For infrastructure limits (and my boss!) , I can't use xCode anyway to build the app in a native way.
The only NATIVE functionality required by the web app should be a simple "Add to contacts".
I've tried to implement it with phonegap , but it works only compiled under xCode.
Is there any way to "add to contacts" without building an app (using only a web-app )?
Thanks in advance
Andrea
I don't think there's a way for you to add a contact directly, using only a web app.
PhoneGap was made for this sort of thing, allowing you to access a device's features (like Contacts, Camera, GPS, etc). But if your company's project specifications don't allow for an app... I don't know that there's a way to do this directly, via the web.
If you're building a web app... while you may be targeting iPhones, you're still making it available to anyone with a browser. I'm not 100% on this, but having some way for a web page to directly manipulate a (Mac) user's contacts seems like a security issue.
As a test, I tried placing a vCard on a page, and accessing it via my iPhone. Changing the extension from .vcf to .vcard didn't yield anything (and for some weird reason it prompted me to open the file via Dropbox).
What did work was emailing myself the vcard as an attachment. I was able to view the attachment, which then gave me the option to add the info as a new contact.