// I need to

ModernizeUpgrade without breaking it RescueFix what someone else started Build NewTurn an idea into a product Reach More PeopleGet found, get used, include everyone

// Company

Case StudiesExpertiseAbout + CareersResourcesContact Book a call →
≡articleBuild New

Gate External Links in Kids' Apps

iOS 7 requires kids' apps to use a parental gate before linking out or selling. What App Store rule 24.3 asks for and how to build a gate that complies.

Art+Logic Dec 19, 20133 min read

From the Art+Logic archive · written in 2013. The tools may have moved on; the thinking still holds.

Photo of wall and gate by Henning Kesselhut on Unsplash

Release after release, Apple raises the bar on its requirements for inclusion in its app store.  Sometimes these are welcome technical changes, like explicit user permission to access contacts.  Other times they feel more like hurdles for app developers and users to jump, or in this case, the appropriate metaphor is stepping through a flimsy backyard gate.

iOS 7 introduced a new requirement for kids apps:

24.3 Apps primarily intended for use by kids under 13 must get parental permission or use a parental gate before allowing the user to link out of the app or engage in commerce

This requirement was probably inspired by the Children’s Online Privacy Protection Act (COPPA), which establishes rules related to collecting personal data from children.  Apple applies the requirement to interface elements like iTunes app store links and social sharing buttons.  However, the requirement is remarkably non-specific as to what constitutes a sufficiently sturdy parental gate.

iOS 7 does not include an API for constructing a gate, and Apple does not provide any further clarification.  Is the gate as simple as a yes or no question or a birthdate entry field, like a website age verification form?  Or as secure as requiring the user to enter a secret passcode?

Many apps are implementing gates that require the user to perform some action that would be difficult for a young child but easy for an adult, like:

A blog post at Moms with apps showcases a nice screenshot gallery of parental gates implementing these ideas.

Implementation

There are at least two publicly available implementations, including:

MKParentalGate screenshot
MKParentalGate
Software screen capture
ParentalGate.com

\

Writing your own implementation based on UIAlertView with a text field is quite straight-forward.  Here’s an example that uses a success block.

@interface ParentalGate : UIAlertView
typedef void (^ParentalGateSuccess) (ParentalGate* gate);
@property (nonatomic, copy) ParentalGateSuccess success;
- (id)initWithSuccess:(ParentalGateSuccess)success;
@end
@implementation ParentalGate
- (id)initWithSuccess:(ParentalGateSuccess)success;
{
   self = [super initWithTitle:@"35 + 55"
                       message:nil
                      delegate:self
             cancelButtonTitle:@"Cancel"
             otherButtonTitles:@"Continue", nil];
   if (self)
   {
      self.success = success;
      self.alertViewStyle = UIAlertViewStylePlainTextInput;
   }
   return self;
}
- (BOOL)HasCorrectAnswer
{
   NSInteger answer = [[self textFieldAtIndex:0].text integerValue];
   return 90 == answer;
}
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView*)alertView
{
   return [self HasCorrectAnswer];
}
// Use didDismiss rather than clickedButton because a display bug can occur
// if the caller tries to show another alert view before this alert view
// has been dismissed.
- (void)alertView:(UIAlertView*)alertView
didDismissWithButtonIndex:(NSInteger)buttonIndex
{
   if (1 == buttonIndex && [self HasCorrectAnswer])
   {
      self.success(self);
   }
}
@end

The alert view enables the “Continue” button only when the correct answer is provided. When the alert view is dismissed from the “Continue” button, the success callback function is run.

Example usage:

ParentalGate* gate = [[ParentalGate alloc] initWithSuccess:^(ParentalGate* gate)
{
   [[UIApplication sharedApplication] openURL:iTunesLink];
}];
[gate show];

It can, of course, be made more secure by randomizing the equation numbers with a random number generator, like:

// Generate a random number between 10 and 100.
10 + arc4random() % 91

Will Apple accept this gate? Past performance is no guarantee of future results, and I would consider a sturdier gate for an app targeting 9-11 year olds. But until Apple provides further clarification directly or through responses to app developers, it appears to be good enough.

keep going

More to explore in Build New.

All Build New resources →
let's talk

Got a problem like this one?

Tell us what's stuck. A real person replies within one business day.

Talk to our team →

Talk to people who know software, not a sales script.

Your first call is with Aja, our VP of Sales. He'll help make sure you're solving the right problem. Here's what you'll cover together:

  1. What you're trying to accomplish

    The business goal first, then the technology.

  2. Possible approaches

    And the tradeoffs of each, in plain language.

  3. Risks you may not have considered

    Technical and business, before they cost you.

  4. Whether AI changes the math

    What's practical, and what's just hype for your project.

  5. Sensible next steps

    Even if the right next step is not us.

book-a-call.ics

Loading the scheduler…

Open the booking page →

Some problems are easier to explain in writing. Send us a few lines about what you're working on, and we'll reply within one business day. Helpful to include:

  1. What the software does, or should do
  2. What's stuck, or what's worrying you
  3. Any deadline or budget you have in mind
note.md

Loading the form…