How to open image in my ios app from another app? - iphone

As Instagram and some another apps have option to open image in there app from any other app. I also want to do similar kind of thing for my iOS image processing app. So user can open there image from any app in my iPhone/iPad app. But I don't know how it is possible.

Navigate to your project.
Select your app target and open "info" tab.
Now in "Document Types" add a document type with these settings:
Name: "whatever" or "image"
Types: public.image
Save this and compile the app. Now your app should show in open in... list from other apps.
Now follow apple Opening Supported File Types and continue your development
For a complete list of types follow this: Uniform Type Identifiers Reference

Yes you can open any file type in other supported application in your iOS device with "Open In" option.
Please follow this apple document for Document Interaction Programming Topics for iOS will be helpful to you.
1) You can also refer this tutorial In which explain with example of pdf file.
2) For customisation check this and other possible types found here.
you can manage different types of document by adding UTI.

Related

Open the app from an external link with universalLink or deeplink

I want to open app from an external link, for example a link that I get in iMessage, the question is, I should use deepLink or universalLink, I want to open the app when I tap on the link, then having ability to read the url in the app is enough for me.
And for this matter, I should set a Json file in the website as well? something like this:
https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app
It's a bit confusing for me, could anyone gives me a real example and steps?
Thank you
Yes, basically both the app itself and the website need to be aware that you are going to be using Universal Links. There are a few steps to do this:
First you need to include the website as an Associated Domain inside of your Xcode project.
Then for the website you do have to create what is known as the apple-app-site-association file. This lets the the website know which apps are associated with the website.
This tutorial has a step by step on How to setup your website to work Universal Links.
Lastly you will have to have to update your AppDelegate file to handle when a Universal link opens the application.
More info can be found in the official Apple Documentation on Creating Universal Links.

Support custom file extension in a flutter app ( Open file with extension .abc in flutter )

So I am exporting a file created in my application with extension .abc
Now, if the user shares the file on whatsapp or telegram or any other platform and when other user tries to open the file, the "open with" dialog should appear with my application in the list.
I have tried following approach which does not work plus it is only for Android and I am looking for multi-platform solution to this.
Is it possible to register a Flutter app as an Android Intent Filter and to handle Incoming Intents?
I was able to compile the app using above method but could not populate "Open with" dialog with my app's name
Thank you for your time.
EDIT 1:
So I have successfully added this functionality for android but I am still trying to add the same functionality for my iPhone users.
Can someone please help me with swift code part in iOS ??
I am not familiar with swift language but I want my users to be able to use same functionality on both platforms.
I have found a solution for iOS:
You can use the Uni Links package to get the notifications into your Flutter app.
You then need to manually add the file types in the Info.plist for the XCode project. You can find an explanation for example here.

Importing PDF files to app

I am trying to import a PDF file from other applications, such as mail, but I'm not sure exactly what I should be looking for. I want my user to be able to tap on the share button in a PDF and my app to be listed there as a place that can accept them, such as "Copy to iBooks"
Any good tutorials? Or suggestions as to what I should look for?
Preferably in Swift
Thanks!
You may use Action Extension for making PDF available in your app
Below i have linked Some Tutorials for Action Extension which is not perfect for your requirement but you check the concept and basic implementation for it
Bookmark from Browser
Read a text
Official apple doc
You can tell your app which types of documents it will support in the info.plist. A good place to start is Registering the File Types Your App Supports
in the iOS documentation.

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 native iOS application to interact with Safari browser?

I would like to enable interaction between a native iOS application and the Safari browser such that tapping a right click on an image on a webpage provides an option in the context menu to send the image to another custom written native iOS application for further processing and/or storage.
However, according to this article from Safari Developer Library, “Safari extensions are not currently supported on iOS”.
Is there any other alternative to achieve the above functionality?
You have multiple choices here:
You could register in your application's Info.plist file that your app known how to handle certain type of documents (see here in Apple's doc). This way when your iPhone encounters this document type, iOS will propose the user to open this document in your app; for example if you register for the PDF type and you then tap on a PDF document as an attachment in a mail, you app will be listed in the proposed menu and will then be opened with the document as a parameter.
But it seems that even if this works perfectly for any type like DOC, PDF, or even custom types, it does not work for images, which seems to be handled in a separate way by iOS :(
A simpler way would be to register, still in your application's Info.plist, any custom URL schemes. See here and below in the Apple's doc. For example when, anywhere in your iPhone (either in your own app, or in another third-party app, including Safari), it encounters URLs like "myapp://xxx/yyy/zzz", it opens your app, passing this URL as an argument. You can then do whatever you want with this URL.
The solution then is to add some code in your web page so that when the image is tapped, you ask Safari to open the URL "myimageditor://edit?url=http://www.url.of/your/image.jpg". If you registered for the "myimageeditor://" URL scheme, you app will then open with the URL in the parameters, and you then will be able to retrieve the image using the embed URL.
I think it is possible only for jailbroken devices.