My app defines a custom document type and when I tap on an attachment my app appears in the "Open in..." menu however I was wondering if it was possible to not show this menu at all but rather open the file immediately in the app.
No, not possible. You have no control over what the Mail app shows to the user when an attachment is selected. The Mail app, like many other apps, uses a UIActivityViewController to give the user lots of other choices. Opening the attachment in your app is only one possible action a user may want to perform on the email attachment.
Related
When I share a file via iOS' UIActivityViewController, I can press the "More" button and see a bunch of apps that I can send my file to. My question is: how can I add a button in my app that would send a file specifically to one of these apps (provided that it's installed of course)? Like a "Send to Slack" button or something like that.
Please note that I am not asking how to show a UIActivityViewController, that's working just fine. I want to programmatically send a file to one of the apps that are listed in the UIActivityViewController's Apps that can receive said file.
I am writing an IOS app that needs to be sent a specific file type via email. I have this working - I created a custom attachment type, and I handle opening it in my application delegate's openURL: function. But, when you click on the attachment in the Mail app, it gives you a horizontal list of applications to open the attachment type - such as iMessage, Mail, Notes, Messenger, and some others. My app is in there too. So to open the file in my app, you go through the following sequence:
Click on the attachment in the Mail app
The box pops up asking you to choose the app to open the attachment in
You scroll over and choose my app
The file is opened in my app.
I would like to skip steps 2 and 3. Is there any way to do this? This attachment file is something that will only be handled by my app. I'd like to register my app as the "exclusive" handler for this custom attachment type. Or something like that...
Thanks in advance.
I've used the code from this answer in order to add my application to the list of choices a user sees when they tap-and-hold on an attachment in Mail. Everything is working, but my problem is that my application's icon is labeled "Open in {my application}". We wish to have this instead say "Forward with {my application}" or even just "{my application}". Is there any way to change what this says here?
That text is fixed as part of the standard UIDocumentInteractionController. There is no setting or API that allows an app to specify a different label. Submit an enhancement request to Apple.
I was wondering if there is an API available for the "Open with" / share dialog. I see 3 social networks (Twitter, Facebook, and a JPN site) by default in iOS, but I was wondering if it was possible to register your own app to accept these options.
It's not quite clear what you're asking. If you just want to present that Open With dialog, it's the UIActivityViewController. You can even implement your own custom UIActivity to appear in the dialog, but that will only appear if the user summons the activity view in your app.
http://www.apeth.com/iOSBook/ch26.html#_activity_view
If you're asking how your app can appear when the activity view is summoned in another app, if you export a document type in your Info.plist, your app will appear in the Open With dialog if the user starts with a document of that type.
http://www.apeth.com/iOSBook/ch36.html#_document_types
I want to open a file browser when I click a button in my application. For example if we want to send an email, we will attach a file by clicking attach file button. Like wise in iOS
if I click a button, a file browser should open and it should be possible to open a file with the ending pdf.
This isn't possible. Your app can only act in it's sandbox or access files which are meant to be shared (like photos or contacts).