Customizing UIDocumentInteractionController - ios

Recently I was trying to customize UIDocumentInteractionController. Specifically removing 3-rd party apps from it.
I have read many articles and topics, but all I found out, is that it’s simply “uncustomizable”.
I am trying to pass my image to other apps.
So I have a share button, and I need it to show UIDocumentInteractionController only with social media services like (Facebook, Twitter, Message, Mail, etc) but exclude all other apps that use an image as a basis. I know there is a UTI option, but is there some kind of UTI that will represent only social media options? I didn’t find it. I almost lost my hope :(
But here I opened my Snapseed. And here you go - “Open in” has UIDocumentInteractionController with all apps that can work with images. And there is “Share..” button that has only socials. So can someone explain to me what am I missing? How can I achieve close enough results?

Related

Can I bypass UIActivityViewController but still somehow use its target-specific share logic?

I've got my app sharing just fine through UIActivityViewController, but I want to instead add explicit Facebook, Twitter, etc. share buttons to my interface. What I want is to bypass the UIActivityViewController popover that allows you to pick the share target, say Facebook, and instead go straight to the same share mechanism that UIActivityViewContoller goes to when you hit its Facebook button. I just don't see any documentation for how to do that.
I understand that I can recreate the mechanism entirely, but I don't want that. I'm sharing a video and using Charles (network traffic monitoring tool) I see that there are no less than 11 graph API calls during the entire process. Not to mention that I like the existing behavior if you're not logged into the FB app, don't have the FB app installed but are just logged in in the IOS settings, etc. I'd prefer to not recreate something that is already working perfectly for my purposes.
I have two reasons for wanting to bypass UIActivityViewController. First is to make the share buttons more accessible. Secondly is for efficiency: I've captured camera frames and share them as an animated gif for most targets but as a movie for Facebook (since FB can't handle animated gif). So the process of making the movie (which takes a couple of seconds) in response to the user activating UIActivityViewController is wasted unless the user shares to facebook. With the broken out share buttons I can avoid packaging the content for the other share targets unnecessarily.

How to disable extension sharing via excludedActivityTypes?

I've built a sharing method using UIActivityViewController but I only want Airdrop, Twitter, Facebook, Messenger, and E-Mail to show up when one presses the share button. I've managed to disable paste board, print, copy, reading list, etc. but apps like pinterest won't work for what I'm doing. How would I disable sharing via extensions?
That's currently not possible. You should file an enhancement request with apple explaining why this would be useful to the user/developer.

How to get images from email or desktop into iOS app?

I know this is a very basic question, but something I'm never quite sure of, is how do you get images from say your email, or from your desktop (say a Mac) into your iOS app?
Let's say I develop an app and I want people to be able to put their company's logo into it, how would they do that? I presume they don't have their company logo in their phone, so how would they get it from another source into the app? If they linked to it on the web, wouldn't that just open a UIWebView to show it? i.e it wouldn't load the actual .png from the web direct to be used by the app or would it?
So, to avoid long comments, I'm putting my answer here, although this is a very general question.
The common thing with all the apps that want an image input, is that they require the user either take a photo with their phone camera, or grant access to the photo library, so that the user can select an image and upload it to the app. If you have used any of the photo-involved apps these days, you should be familiar with this. Example is Instagram, Facebook, Flickr, etc.
However if you really really want to let the user download it off the internet through your app, then you should embed a web browser in your app, allowing the user type in a URL and save the file in that URL to the documents/downloads folder in your app, and then allow them access those folders to browse and upload stuff. A good example of this kind of app, is "NuageApp" which is actually a client for the Cloud App. It's really handy to deal with file sharing the way NuageApp (funky name, huh?!) does, however it's far more complicated to implement that, than the access to the photo library.

"Open in" feature in UIActivityViewController

I need your help with UIActivityViewController.
I need to present activity controller for the file where, except for default actions, the user will be able to open the file in other apps.
I know how to do this with UIDocumentController, which shows popover with all apps able to open the file.
But how can I show all these apps in UIActivityViewController?
P.S. This behavior can be seen in Apple Mail app, for example.
Look at TTOpenInAppActivity for a way to combine both a UIActivityViewController (for normal sharing), and an 'Open in' button on that which brings up a UIDocumentInteractionController. Pre-iOS 8, that is the best way to manage this.
The function and behavior is different between UIActivityViewController and UIDocumentController.
UIActivityViewController
Presents activities that are pre-defined, you can pass an array to select which ones should be excluded among the default ones that are presented, if you want to add more activities you have to use custom activities, unfortunately these will appear bellow the rest of the activities and even more, the icon will always be gray, your app never loses control since you can use delegates and other stuff to know what is going on on those apps. (Unless you manually make an activity which opens another app)
UIDocumentController
This one asks the system for all the registered applications for a certain file extension, many apps have registered their exclusive extensions which makes it so that this app will be the only one displayed. If you pass an image, you will see all the apps that can handle this file. When using this one your app will lose control since the other app will be opened.
What is your final objective?, If you describe it with more detail we could offer you a better solution.
From what i understand, you should see yourself what type of file the user is trying to open, and then yourself open it with the most suitable one.
Since you cant really emulate what apple is doing, you should handle this problem through your interface, offer the user to "share" or to "open with" for example.
The answer is very simple. There is no way to do it. You cannot add the apps except the defaults into the UIActivityViewControllers.
You are absolutley correct, you can acheive this through the UIDocumentInteractionController.

Add custom UIActivity for standard apps

dear community,
A simple question but no clear answer yet.
Can I add my button to standard UIActivityController so that when user goes to Photos/Notes/Safari he can also along with twitter/facebook post it to my destination ?
I'm sure I can do that while calling UIActivityViewController from within my app.
And looks like there is a way to do that for mail attachments. Box app can do that here, probably via CFBundleDocumentTypes in plist. But is there a way to do that with e.g. photos?
Hopefully anybody can give me any useful links with examples of such implementation.
Thanks a lot
--Dannie
As of iOS 6, there is no way to add a custom UIActivity item to built-in apps like Photos, Notes, or Safari.
Custom UIActivity items can only be added to third-party apps.

Resources