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.
Related
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.
I am searching for the last week over many websites, and I can see people with the same question, but they are mostly misundestood.
What I have:
I have an iOS application that can receive URL from browsers (made with ionic/cordova)
What I want:
When I am on Safari (or other browser), i want to use the button Share, and my app appear there, in the list, just like Twitter, Facebook, etc. (I put an arrow in the image below).
Like this:
And, I want this working on many iOS versions.
So, I tried to change my app-info.plist many times and nothing works.
Somebody have a solution for this? Somebody have a info.plist that do this job?
(PS: I donĀ“t want to use URL scheme, links, etc... Its the browser SHARE)
Thanks!
The only way is to create a share extension, as mentioned. It is not a trivial task in that you have to incorporate a lot of pieces together to make it work. Also, it is only supported on iOS 8+, which I guess shouldn't be a major issue at present.
In a nutshell:
Create Share Extension in XCode
Create a JS preprocessor
Add plist key/value pairs for related ExtensionAttributes
Set up custom URL scheme
Customize ShareViewController
Set up global handler function to perform your desired actions in app
See Cordova: sharing browser URL to my iOS app (Clipper ios share extension)
Or https://www.inshikos.com/blogs/76/dev/link-and-photo-sharing-to-a-cordova-ios-app-via-share-extensions-ios-8 that expands it further to include photo and wider share scenarios.
And, yes, a terribly misunderstood question with many false positive answers in other posts.
my question is quite simply, how can I popup the following view in my app?
I've seen this in quite a lot of apps, so I believe this is a system-level view controller? But what is it? How can I show it in my app?
As far as I know, that is NOT a system provided view. You'll have to detect a denial of permission by the user, and then create a view to display. Many people copy Apple's style for this view in order to make their apps 'blend in' with the platform, but its not directly provided to third party developers.
You do not have to pop this by yourself. Whenever you implement functionality that needs privacy settings, the OS asks the user if he would like to let your app to use this functionality (for example contacts or camera) automatically. If he denies to give access, then he will be presented with a view like this one whenever he tries to use that functionality again (unless of course if he has changed the settings manually in privacy settings).
As we know, at iOS, we could use UIDocumentInteractionController to display the "Open in" menu where a list of third party apps which could handle the document. User could pick one app to open the document at that app.
We are looking for if we could only display a partial list at the "Open In" menu so we could apply security control here. With UIDocumentInteractionController, somehow we didn't find a way to do this. Is this possible at iOS?
since no one is answering this question, I am going to answer myself. Based on current research, there is no way to do this at iOS 6. However at the iOS 7, there seems a new feature added to manage open in per these 2 links although I haven't got chance to look into API yet.
http://www.pcmag.com/article2/0,2817,2424581,00.asp (open in management)
http://www.maas360.com/products/mobile-device-management/apple-ios/ (Manage open in)
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.