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
Related
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.
I have added title, description,image and a URL link to client page in activity items of UIActivityViewController, but the share dialog shows only the image.
It used to work fine before, has there been any update in UIActivityViewController or facebook share dialog recently?
From https://developers.facebook.com/docs/sharing/ios#ios-integration:
Use of the iOS share sheet is subject to Facebook Platform Policy, including section 2.3 which states that apps may not pre-fill. In the context of the share sheet, this means apps may not pre-fill the share sheet's initialText field with content that wasn't entered by people earlier in their use of the app.
Looks like we are out of luck.
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.
Show my own application in share dialog in iPhone just like screenshot you can go in photo and click on share then you see Facebook, mail, Twitter etc. i want to show my app icon "weibo"]
please reply ???
If only Googling for that turned up a result on the Apple developer site. You need to define a type identifier for your data, then declare it as imported.
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)