Simple Parental Gate for Apple iOS using UIAlertView

I have been looking at this whole Apple Parental Gate issue and trying to come up with a simple solution for iOS. So instead of creating a whole SDK, I decided to implement this simple parental gate using a UIAlertView.

Please leave a comment with regards to whether or not Apple accepts your app with this gate in it.

//Parental Gate
NSString *pgQuestion = @"";
int pgTag = 0; //7771 7772 7773
int pgAnswer = (arc4random() % 3) + 1; //Choose random interger between 1 and 3
if (pgAnswer == 1) {
pgQuestion = @"PARENTAL GATE:\nHow many of the following\nnumbers are divisible by 3?\n1, 2, 3, 4, 7, 8";
pgTag = 7771; //correct answer is 1
} else if (pgAnswer == 2) {
pgQuestion = @"PARENTAL GATE:\nHow many of the following\nnumbers are divisible by 3?\n2, 3, 4, 5, 6, 7";
pgTag = 7772; //correct answer is 2
} else {
pgQuestion = @"PARENTAL GATE:\nHow many of the following\nnumbers are divisible by 3?\n3, 4, 6, 7, 8, 9";
pgTag = 7773; //correct answer is 3
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:pgQuestion message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[alertView setAlertViewStyle:UIAlertViewStylePlainTextInput];
alertView.tag = pgTag;
[alertView show];
[alertView release];

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == 7771 || alertView.tag == 7772 || alertView.tag == 7773) {
//Parental Gate
if (buttonIndex == 1) { //OK button
int parentalGateAnswer = [[[alertView textFieldAtIndex:0] text] intValue];
if ( (alertView.tag == 7771 && parentalGateAnswer == 1) || (alertView.tag == 7772 && parentalGateAnswer == 2) || (alertView.tag == 7773 && parentalGateAnswer == 3) ) {
NSLog(@"==Parental Gate SUCCESS");
} else {
NSLog(@"==Parental Gate Incorrect Answer");
} else if (buttonIndex == 0) { //Cancel button
NSLog(@"==Parental Gate Cancel");

You can also download it from here:

Galaxy S3 won’t connect to Mac using Samsung KIES and USB cable (device will not connect)

So I was trying to connect my wife’s Galaxy S3 to my Mac so I could download all her pics and videos, but was having quite a difficult time getting the phone to connect via USB cable. (NOTE: I am running OSX Lion 10.7.4 and Galaxy S3 has Android 4.1.2)

I tried AirDroid 2 which actually works quite well if you are looking for a wireless solution, however it is very slow if you have a large amount of data to transfer. So seeing as I had to transfer 12GB of data from her phone and I did not have all day to wait for it to transfer, I decided I would try to connect via USB cable to speed up the transfer.

So step one was simply plugging in the phone via USB to my Mac. There is a setting called USB Debugging that needs to be turned ON for this to work and for the Mac to normally recognize an Android device, however trying it both ON and OFF did not make a difference, and my Mac would not recognize the S3.

So next step was to install Samsung KIES on my Mac. After installation I started up KIES and then plugged the S3 into USB cable, and I would get a message from KIES saying “Connecting..” but then about 5 seconds later would get another message saying something like “No response from device” and “Cannot connect.”

So after several hours of Googling, I finally came across the following post which contained the solution in one of the comments:

There is a hidden menu on the S3 called Phone Utils. To access the menu, go to your dial pad and dial *#7284# (star-pound-7-2-8-4-pound).

You will then see another menu option called Qualcomm Options, so click on that, and then change the option to MTP+ADB and save the change. Now try plugging in your S3 to USB again and KIES should now recognize it and connect.

Alternatively, instead of the Qualcomm Options, you might see the UART menu with two options of MODEM or PDA. Try changing it to the other option and then try plugging S3 into USB again and see if it connects. If it still does not connect, switch it back to the original setting.

One more possibility is under Developer Options. To access Developer Options menu in Android 4.3 you need to un-hide it and make it visible. To do this, go to Settings > More > About Device then tap on Build Number seven(7) times and then go back to Settings > More and Developer Options should be visible.

That’s it! Leave a comment and let me know if this helped you out.