UTIs for the gallery App share function - ios

I am implementing Foto/video/others import in my App.
Using the UTIs public.image, public.movie, com.adobe.pdf, etc works fine on a lot of Apps, but apple's gallery displays only Mail,Facebook,twitter and youtube in the Share function.
How to get my App in this list ?
Thanks!

Your app is a consumer (you said you are importing.) Apple's Gallery app is also a consumer AND a producer. As a producer, Gallery could share with your app as a consumer.
On the desktop (OSX) declaring the UTI's that your app supports (produces or consumes) in your app bundle is the first step. Then in what is similar to 'sharing', the Finder lets you double click a file (document) to open it with the default app (or other app) that supports the UTI. Finder is part of security (sandboxing): the user is in charge when using the Finder and the OS assumes the user understands the security implications of sharing content between apps, but the Finder may still give warnings about security.
On iOS, I suppose you are asking whether declaring UTI's in your app bundle is sufficient for the Share button? I don't know. In iOS8 apparently you need an App Extension.

Related

Swift: How to import other files to your app

I am developing a file manager app , and I need to users able to import other files to my application, I searched many question but did not success !
First I register file types using : Registering the File Types Your App Supports,
But when I tap share icon on safari or photos there my app won't show in list of apps.
And then what is the next step to import files and store it to Document Directory of my app?
In iOS other apps will not just automatically communicate with your app. You have to create an extension that lets the other apps like Safari or Photos know that your app can talk to them. A basic description for this can be found in the App Extension Programming Guide.
There they also point you towards sources on how to work with the iOS file system.

Deep Linking in iOS - Navigate to Apple Store if app not installed

I need to implement Deep Linking concept without using any third party libraries (Branch and etc..). The link (starts with http/https) will be shared from app through Message, Email or any Social media apps. By tapping on shared link I want to open corresponding app if its already installed on device else it should navigate to the Apple Store to download the app.
I have knowledge on URL schemas but it works only when the app is already installed on device and the schema URL format also be different (like fb:// for Facebook app).
I have also done some R&D on Universal Links but I don't know whether it supports for dynamic links as for me the link will be combination of base URL(static) and referrer key(dynamic). I also need to track the referrer information once the corresponding app is opened like who referred this app (referrer details).
e.g: https://domain.com/ReferrerID
Can you please help me on it. Thanks in advance.
To make it clear on Universal Links in iOS will not take you to Apple Store if app is not installed on device. When you click on a link then Universal Links helps you to open the app if the app is already installed on device else the same link will be going to browse in Safari. When the url browse in Safari then we have to run JavaScript to navigate/redirect to Apple Store.
Yes you can support universal links to your application from iOS 9 or above. You can generate dynamic links and have deferred deep linking also.
Follow this steps its simple Click Here
For the file mentioned in the link you need to add that file in the root of your website which consists of the path valid for deeplinking. And that file should not have any extension.
Then validate your domain at Here.
After that you can add all the domains thing in your associated domain under the project capabilites.

How to access all the files(pdf, doc etc) in iOS?

How can I find out programmatically all the files present in iOS device and list them out to user? Also I need to download the file in my local application database?
How this can be achieved with Objective-C.
You cannot access all files in an iOS device outside the sandbox of the app. But there are other ways you can achieve this. What you can do is:
Access all the files in Gallery using UIImagePickerController.
Access all the user files in network- Dropbox/Google drive/iCloud. They all have separate public APIs that can be downloaded and used to download/upload files in network.
In this way, you can access most of the user files and use the same in your application.
Simple answer : you can't (on a non-jailbroken device).
Each app is launched is in own sandbox and can't interact with the others apps, expect using API provided by Apple for app-communication (ex: extension)
You should look at that Apple guide about App Sandboxing, which is valid for OSX and iOS apps.
The main difference between these two OS, as quoted directly from the doc :
iOS Note: Because it is not for user documents, an OS X container
differs from an iOS container—which, in iOS, is the one and only
location for user documents. In addition, an iOS container contains
the app itself. This is not so in OS X.
You cannot access all the files outside the app sandbox. But, if they are available at some shared location(network), you can use third party libraries to access them. For eg.
1. For iCloud- iOS provides inbuilt framework of UIDocument
2. For dropbox- DropBoxAPI is available
3. For Google drive- there is a separate library to access files in the drive.
Hope this helps :)

List apps in the App Store that can support a given file type

I am working on a app which needs to open/preview a file using UIDocumentInteractionController. One of the clients requirement is that, in case there is no installed app which can support a given file type, then the app should redirect the user to the App Store, displaying a list of apps which can open the file.
Is that possible? If yes, could you give me a step-by-step approach ?
The app store does not have any list of apps can open a given file type.
You will have to build the list yourself.

for iOS dev, how my app might know, for a given file type, which other app could open it

in iOS devices, the Mail app offers "Open In..." option for attachments. The apps listed have registered their CFBundleDocumentTypes with the OS. What I am wondering is how my app might know, for a given file type, which other app could open it ?
There is no public API for this, however, you can open the sheet that Mail.app shows using the UIDocumentInteractionController class. It doesn't give you access to the names of the Apps that can handle the document, but its probably better than nothing.

Resources