I'm trying to move my app to use UIActivityViewController, rather than UIActionSheet, so that I get the fancy graphical sharing buttons rather than the textual buttons. (My app is targeted at iOS 6 only.)
After trying to work with it for a couple nights, it seems either I am totally misunderstanding how to use it, or the current implementation by Apple is terrible:
You can't specify a different message for different services. If I want something that will work across: Mail, Facebook, Messages AND Twitter, it's going to need to be 140 characters max, to work on Twitter. Is there a way to set custom content for each type of activity?
There appears to be no way to set a subject line or recipient for Mail messages. I've read the docs, they make it sound like this might be possible with an NSURL that uses the mailto: protocol, but in my tests, those URLs just get shoved into the message body. Is there actually a way to set the subject line and optionally, the recipients?
If I want to work around these shortcomings, and do my own custom activities by subclassing UIActivity, I have to use a custom image/icon. Therefore, I can't mimic the Mail activity with Apple's official icon, and e.g. implement my own custom activity backend that actually lets me set the subject line, recipients, custom body, etc. Am I wrong, is there a way to use Apple's service icons, but have a chance to customize the behavior? (The only callback I see is one that runs AFTER the activity has been completed, right?)
I hope I'm wrong!
Is there a way to set custom content for each type of activity?
Yes, I guess you should subclass UIActivityItemProvider and override method –activityViewController:itemForActivityType: with your logic (e.g. trim string to 140 chars for Twitter).
Then pass an instance of this class to -[UIActivityViewController initWithActivityItems:applicationActivities:].
Is there actually a way to set the subject line and optionally, the recipients?
You are right, the mailto scheme should be able to set these fields. If it is not working, I consider this as bug. (Didn't try this myself, but I will give it a check.)
Is there a way to use Apple's service icons, but have a chance to customize the behavior?
I think you can't do this. (Unless you want to hack those system activities.)
You are better off using a custom component that behaves like UIAcitvityController as it is quite limited, as you noted.
This is one example: https://github.com/hjnilsson/REActivityViewController , I just forked it from https://github.com/romaonthego/REActivityViewController to allow you to set the email subject field.
Related
My application sends blocks to slack that require user decision about certain things. Let's simplify it and say it's a "yes" or "no" button click. The thing is--- the object this decision works should work on is a combination of app_domain -> element_type -> element_id -- those three fields are a MUST to identify which object to work on.
Maybe I'm reading the docs wrong, but it seems Slack is pretty limiting and there is absolutely no place to include a custom struct that'll go along with every message the ping-pong of app -> slack and slack -> app interaction. I am limited to block_id and action_id pretty much and there is absolutely nothing else I can put custom context-keeping data on. I don't get this crude limitation. Do I really have no other choice other than putting "xxxxxx|xxxxxxxx|xxxxxx" on the block_id string so that I can later decode those three IDs in my app to know what objects to work on when the user clicks an interactive button?
There's got to be a smarter way. Any pointers?
There's another customizable field in the blocks:
private_metadata
https://api.slack.com/reference/surfaces/views
Problem
I'm trying to provide my users with an alternative to purchasing my iAP by allowing them to share that they're playing the game via facebook.
However, when the composer view controller loads the content is editable by the user. Which, for profitability sake is a bad thing. They could remove the entire message and still receive the perk that they receive for sharing. Thus, ruling out that way of marketing.
I'm curious as to two solutions.
Solution One
Force Read-Only ?
Solution Two
Cancel the sharing and display an error message if the sent message is not equal to the initial text/images.
Also, if it is not possible for them to remove the image and/or url then I don't really have a problem with them adding their own text. However, if they can remove the image/url then there is an issue.
Thank you for reading.
Restricting/enforcing what to share by the user, in any way, is not allowed in the Facebook Platform Policy. See also point 2 of: https://developers.facebook.com/policy#control. You can't make the share dialog read-only and you should not check if they shared the content you have provided.
With the second solution; you might also be hitting a policy restriction. You should not incentivize people to share in order for these kind of promotions. See rule number 5: https://developers.facebook.com/policy#properuse. This might be an more difficult issue though, policy wise.
You can let people share an open graph object; either generated from your app or directly one that you (or FB) is hosting, with an open graph url. For that, see https://developers.facebook.com/docs/sharing/opengraph and https://developers.facebook.com/docs/sharing/best-practices.
In interface builder, there is a option that lets the user clear a TextField when they hit the (x) key. Since I think this option is extremely useful, I want to implement it in as many TextFields as possible.
However, the default implementation of the option is "never appears", and I want to keep as many default values as possible (because I think Apple considers the default interface behavior very well).
So my question is: when should I change the value? And if so, to what should I change it (always, when editing, or unless edition)? Here are some occasions I need to know:
On a table view
when the user enters his account details (email, password, name, etc.).
If you come up with other cases I should consider, please let me know!
Sorry, but I couldn't find any documents about this part of the UI in apple's documentation (which is very good and precise when it deals with standards).
This question is not about how to enable the key. Instead, it is when to enable it. I know it is my app and I can do whatever I want but I know how non-standardized apps feel like. So I want mine to be as standardized as possible so that the user doesn't experience any weird or usual behaviors.
This ABSOLUTELY depends on the you app design. Apple gives you these four options and it's up to you, which behavior fits your needs best, Apple does not care at all.
I personally only use it "while editing". In the past, I only used them for login or sign up forms.
I have made an applications which has specific font (handwriting.ttf), it works absolutely fine in application but when I email the text written in this font through my application - the font becomes gibrish on receivers end (the reason is that receiver does not have this perticular font in his computer)
I have seen another application that sends text via email using custom font.
This gives me confidence that functionality like this works - but I dont kow how?
When you say gibberish, do you mean that the user is seeing the copy, but with the alignment and other graphical elements getting screwed up, or that you literally see something entirely incomprehensible. I would have expected your font tag to have a series of fonts and that the email would have fallen back to one of the more standard fonts if the attempt to use the custom font failed. Please update your original question with (a) the code that you're using to create your email body, as well as (b) a screen snapshot of how it's rendered in the email client.
Two immediate suggestions:
If you know of other apps that are sending email with a custom font (which I'm surprised by, but I'll take your word for it), have one of them send you an email and then view the source of that email and see what it's putting in the email's html and examine how it's doing it;
Most emails I get that are employing specialized fonts are also incorporating all sorts of graphical elements and it's sending the email as an image (which you can either embed in-line in the html-based email using base64, or put on some server and link to the <img> there), frequently with a text rendition, too. You can use Quartz 2D to create those images that you then embed in your email. Clearly this won't work in all situations, but using images for the body of the email, or PDFs (which you can also generate from the app) for attachments seems to be more common.
Personally, I'd shy away from embedding custom fonts in the html body of the email because you're subject to the vagaries of how the user's email client renders custom fonts, if at all. Plus you'd want to do some exhaustive testing, examining the email in different email clients (as #meccan's commented link had done). If the look and feel of the resulting email are critical and highly stylized, and if the content of the email is relatively short, I'd lean towards option 2.
I am developing an iOS app in which I need a UIControl that allows the user to select between 2 options and 2 options only.
For example, assume I am displaying a form in my app in which the user fills up his personal information like Name, gender, hobbies etc. Here, gender is a possible field for which there are only 2 options (other options are possible, but let's say we don't want it in our app).
I thought it will be nice to use a customized version of the UISwitch for such a case.
But then, I am beginning to think that the UISwitch is applicable only in the context where something is enabled or disabled. Can it also be used in the context where user selects one of 2 choices? Does this go against Apple's design guidelines? If yes, then what other UIControl could I use for this? (I want to use something other than a plain dropdown)
UISegmentedControl is your choice.
You can feel free to use other controls (with customized look & feel) in your app, as long as it does not confuse users.
I'd suggest a UISegmentedControl, which has the behavior you require.