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

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.

Related

Other apps not allowed in UIActivityViewController?

I'm working on an iOS app in Objective-C and I'm currently trying to make a sharing extension with a UIActivityViewController.
I understand that there is an enum of activity that I can individually exclude from the UIActivityViewController with a property of type NSArray called excludedActivityTypes.
How can I also exclude other apps (such as Pinterest or LinkedIn) that the user can manually add/activate/disable from the panel that shows when you hit the "Other" button in the UIActivityViewController ?
Thank you in advance.
How can I also exclude other apps (such as Pinterest or LinkedIn) that the user can manually add/activate/disable from the panel
You cannot. Of course you could try going to the user's house and pinning his arms behind his back, but, short of that, you are not in charge of what the user does.

Application inside another application in iOS

How do you import or display an application inside another application?
It is like, it will be a part of the app where you can use it's functionalities. Maybe in full screen or not in full screen. My thoughts are these are web based and is being opened in a UIWebView to use the functionalities.
Extensions? It's more like "piggybacking".
Here's an example:
https://hub.united.com/en-us/news/web/pages/uber-on-the-united-app.aspx
I'll post an answer regrouping my answer and also #Popeye one that seems valid too.
There may be a few ways to do it, each ones of them may act differently.
The other app offers a public SDK/API/WebServices
As an example, I'll take FaceBook API, that allow you to login giving you a UIViewController (that you can customise), and allowing you to ask for some data through their WebServices (like who are the friends, etc.). You're still inside your app.
The other app offers you a private SDK/API/WebServices
Same as the other one, but it more like a parternship. You're still inside your app.
URL Schemes
The other app gives you a few way to interact with it. They check if the app is installed, and launch it with some parameters, or if not, they may redirect it to the app in the Store, their website, etc. More info about URL Schemes from Apple Doc. You have to check their documentaion to know how to interact with it.

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.

Is there a function which lets you add functionality to an existing app on ios?

I am curious if it is possible to make an app that adds a functionality to an existing app on ipad, say safari. If yes, which function would add a button to safari?
My question is based on 2 app advertisements I saw, one added a button to safari, the other created an app itself. I didnt buy them yet, so I dont know if they really do what thet say.
Thanks
As far as I'm aware, I think the closest you get to adding functionality to an existing app would be creating a new app that allowed interaction with certain document types.
For example, you might create an app that can open and read PDF documents. On installing this app, you would then find that interacting with a PDF document on any app (such as in an email attachment, or opening a PDF in Safari) would show a new option to open the PDF in your app. This kind of interaction is achieved via the UIDocumentInteractionController class.
Beyond that, I believe you would have to create your own app from scratch based on an existing one in order to extend functionality (so, create the 'MyBrowser' app to behave like Safari, except with additional controls and features).
I'd love to be proven wrong, however.

Resources