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.
Related
Is there a URL to open the contacts application from within my application? I know you can achieve this with the settings app by using the UIApplicationOpenSettingsURLString constant in Swift; however, I wasn't sure if I could do the same with the Contacts app.
There isn't a deep link for opening the Contacts App.
Apple is very picky when it comes to deep-linking. They have to provide one for Settings since many apps need services like Data, Location, Bluetooth, Wifi, etc.
Unfortunately they do not extend this to the Contacts App.
However if your app needs contact information then for that Apple has provided a Contacts framework to browse through your contacts within your app itself.
Read more about it here.
In order to add/update/delete/merge contacts directly from your app without using the Apple's Contact UI, use the CNSaveRequest APIs. More on that here.
The closest thing you can get to opening a contact is to write them a message in IMessage. From this screen the user can press the contact icon and open the contact page for that particular contact.
You can do this by opening the url sms://+44776382223 where the number is the number of the person that you would like to view the contact of.
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.
Two observations:
One
It appears that for your app to use Share Sheets (aka UIActivityViewController), you now have to provide either:
An NSURL as one of the ActivityItems, or
A UIActivityItemProvider where the call to super initWithPlaceholderItem: must take an NSURL as an argument
You used to be able to share with plain ole NSStrings
Two
There appears to be no way to share text to Facebook via the UIActivityViewController as of the latest update. Text is stripped away.
--
Are others running into this or is it just me? You used to be able to share text to Facebook... this literally just changed.
How can I share text to Facebook from a UIActivityViewController?
(First of all sorry for the bad english !)
I encountered the exact same problem and my researches had lead me to that explanation :
The last Facebook app version must come with an implementation of an app extension.
Therefore, when the app is installed, the extension takeover the Apple "native" facebook share, refusing all kind of share but url share.
That's why you can share text when fb app is not installed (fb icon is visible), but you can't when fb app is present (fb icon is not even visible).
You can see it if you try to track the activity type :
When fb app is not installed, activity type is UIActivityTypePostToFacebook (which Apple SDK native tool)
When fb app is installed, activity type become com.facebook.share (or something like that)
I don't know if Facebook planned to "correct" that but they had always made clear that automatic text should not be added to user's post (that's what they do on Android).
I think we will have to live with it.
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.
I have integrated facebook SDK in ios,and now want to use like action. For this, I have used like logo of facebook but this is rejected with following message-
"Please address the following feedback from our review team. Once you have made the changes listed below you may resubmit for review.
Thanks for making changes to your submission. This action type still doesn’t meet our criteria to become available to users. Here are the remaining changes that you need to make to your action type: Your button branding doesn’t follow Section 5.6 of the Facebook Terms and Section I.8 of the Platform Policy: https://developers.facebook.com/docs/guides/policy/examples_and_explanations/branding/ The graphics must reflect your own branding and the user experience of your site. Learn more about branding: https://developers.facebook.com/docs/opengraph/submission-process/#uex."
If I will use like button as my application theme, then how user will know that he is going to like on facebook.
According to facebook
You can use the Built-in Like action to create custom buttons in your
app, but the button must not emulate or otherwise copy the design of
Facebook’s Like buttons. For example, you may not use a “thumbs up”
image with the word “like” in your Open Graph actions without prior
written permission from Facebook, and any custom like button you
create must not confuse users into thinking that your Open Graph
action will result in a connection to a Facebook Page.
They have clearly stated that "you may not use a “thumbs up” image with the word “like”"
So what's best thing which you can do ??
just a thumbs Up button.
You may not be allowed to use same button as Facebook has, as per Apple's guidlines.
So, in that case, you can put the same button but with different color OR you can even change the sign of fingers and make a little change in the icon. It will create an impression of Facebook like button but it is not exactly same as it.