Category Archives: Apps

Apps I’ve Written

Awesome Cowbell 2 and in-app Purchase

My friend Carmine and I made an app a few years ago called Awesome Cowbell. We didn’t update anything for a few years and I decided to add in-app purchase to it instead of having a free and paid version on the App Store.

The app wasn’t updated for a while so there was a bunch of iOS 9 related things I had to fix. I created a new project (required iOS 9), fixed the bugs, added in-app purchase, and used storyboards this time instead of the xib I used years ago. It was ready to submit.

Only 4 days after I submitted the app was In Review. After a few hours in review it got rejected because I only implemented a way to use in-app purchase to Buy, not to Restore. I had the code for restoring done already but I didn’t want to add another button to the app just for this. The rejection came on a Thursday so I figured I would fix it on Saturday morning before the Islanders game at 3 (LETS GO ISLANDERS!!)

When I sat down to add the restore function I still didn’t want to add a button for restoring. I decided to use a UIAlertController for this. I just wanted three options (Buy, Restore, Cancel), that’s all I think I need to do to get the app approved. Here is the code I used to do this:

- (void)tapsBuy{
NSLog(@"User requests to Unlock");
UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Purchase" message:@"Do you want to Restore a previous purchase or Buy it for the first time?" preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *restoreAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Restore", @"Restore Action")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
[self restore];
}];

UIAlertAction *okAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Buy", @"Buy action")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
[self purchase:validProduct];
}];
UIAlertAction *cancelAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel Action")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action)
{
}];

[alert addAction:cancelAction];
[alert addAction:okAction];
[alert addAction:restoreAction];
[self presentViewController:alert animated:YES completion:nil];
}

That function is linked to a UIButton that starts the whole buying process. Here is the code I use for in-app purchase and restoring:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
validProduct = nil;
NSUInteger count = [response.products count];
if(count > 0){
validProduct = [response.products objectAtIndex:0];
NSLog(@"Products Available!");
}
else if(!validProduct){
NSLog(@"No products available");
//this is called if your product id is not valid, this shouldn't be called unless that happens.
}
}

- (IBAction)purchase:(SKProduct *)product{
SKPayment *payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}

- (IBAction) restore{
//this is called when the user restores purchases, you should hook this up to a button
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
isUnlocked = YES;
[[NSUserDefaults standardUserDefaults] setBool:isUnlocked forKey:@"isUnlocked"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
NSLog(@"received restored transactions: %lu", (unsigned long)queue.transactions.count);
for (SKPaymentTransaction *transaction in queue.transactions)
{
if(SKPaymentTransactionStateRestored){
NSLog(@"Transaction state -> Restored");
//called when the user successfully restores a purchase
[self doUnlockAll];
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
}

}

}

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
for(SKPaymentTransaction *transaction in transactions){
switch (transaction.transactionState){
case SKPaymentTransactionStatePurchasing: NSLog(@"Transaction state -> Purchasing");
//called when the user is in the process of purchasing, do not add any of your own code here.
break;
case SKPaymentTransactionStatePurchased:
//this is called when the user has successfully purchased the package (Cha-Ching!)
[self doUnlockAll]; //you can add your code for what you want to happen when the user buys the purchase here, for this tutorial we use removing ads
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
NSLog(@"Transaction state -> Purchased");
break;
case SKPaymentTransactionStateRestored:
NSLog(@"Transaction state -> Restored");
//add the same code as you did from SKPaymentTransactionStatePurchased here
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[_buyButton setTitle:@"Unlocked" forState:UIControlStateNormal];
_buyButton.enabled = NO;
break;
case SKPaymentTransactionStateDeferred:
break;
case SKPaymentTransactionStateFailed:
//called when the transaction does not finnish
if(transaction.error.code != SKErrorPaymentCancelled){
NSLog(@"Transaction state -> Cancelled");
//the user cancelled the payment ;(
}
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
}
}
}

If you are still reading this at this point you might have noticed that I call a function doUnlockAll after the user buys or restores. Here is that code:

- (void)doUnlockAll{
isUnlocked = YES;
[[NSUserDefaults standardUserDefaults] setBool:isUnlocked forKey:@"isUnlocked"];
[[NSUserDefaults standardUserDefaults] synchronize];
_buyButton.enabled = NO;
_buyButton.hidden = YES;
volLabel.hidden = NO;
panLabel.hidden = NO;
pitchLabel.hidden = NO;
volSlider.hidden = NO;
panSlider.hidden = NO;
pitchSlider.hidden = NO;
self.admobBannerView.hidden = YES;
}

This is where everything is done when the purchase was made. First I set a BOOL to YES and store it in NSUserDefault (which I call in the viewDidLoad). Then I disabled the buy button and hid it and made the other buttons and sliders visible which are included when you buy the app. I also use Google Ad Mob (I use to use iAds but thats going away in June 2016) so I disabled that after the in-app purchase is made as well.

I have no idea if this is the best way to implement the buy/restore in-app purchases but it’s the way I chose to do it. Get Awesome Cowbell, it’s FREE to download! Follow me on Twitter @jon01 and let me know what you think.

App Santa (2015)

Get them while you can! These deals are only good from today till Christmas.

The apps are:

My New App – Barcode Saver

Scan. Save. Repeat.

Do you want to store your Serial Numbers but hate copying down the numbers? Or maybe you want to just save the URL from a QR Code. Work in a warehouse and need to share bar code information with vendors from your stock? Scan the barcode, Save the text and you are all done! When you are done, open the saved text and Share it via Email, Text, or using the iOS 8 Extensions you have. In the free version of the app, you can display your last 5 scans. You can unlock all of the features of the app via in app purchase including:

Multiple barcode scans
Retake barcode
Unlimited rows
Edit existing text
And More!

I am going to add sync to dropbox/google drive/one drive in the future too. Download it now, it’s FREE to use.

Follow me on Twitter @barcodesaver

App Santa (2014)

Here are the 2014 App Santa deals, up to 60% off!

  • Calendars 5 for iOS $6.99 > $2.99
  • Castro for iOS $3.99 > $1.99
  • Clear for iOS $4.99 > $2.99 and Mac $9.99 > $5.99
  • ColorStrokes $1.99 > $0.99
  • Day One for iOS $4.99 > $0.99 and Mac $9.99 > $7.99
  • Deliveries for iOS $4.99 > $2.99 and Mac $4.99 > $3.99
  • Drafts 4 $9.99 > $4.99
  • Ember for iOS $4.99 > $2.99
  • FX Photo Studio $2.99 > $0.99
  • Gneo $9.99 > $5.99
  • Go Couch to 5K $4.99 > $1.99
  • Group Text+ $2.99 > $1.99
  • Launch Center Pro $4.99 > $0.99
  • Manual $1.99 > $0.99
  • Mileage Log+ $9.99 > $4.99
  • MindNode for iOS $9.99 > $4.99 and Mac $19.99 > $9.99
  • PCalc for iOS and Mac $9.99 > $6.99
  • PDF Expert 5 $9.99 > $6.99
  • Printer Pro $6.99 > $2.99
  • Scanner Pro $6.99 > $2.99
  • Screens for iOS $19.99 > $9.99 and Mac $29.99 > $14.99
  • Solar Walk $2.99 > $0.99
  • Star Walk HD $2.99 > $0.99
  • Terminology $2.99 > $1.99
  • TextExpander touch $4.99 > $2.99
  • Tweetbot 3 for iPhone $4.99 > $2.99
  • Windy $2.99 > $1.99
  • App Recommendations

    I just wanted to write a quick post with a few of my favorite apps and apps I use on a regular basis. Here they are in no particular order:

    Fantastical 2 – The best calendar app, hands down
    Tweetbot 3 – Great twitter client
    BBM (really?!) – Friend lives in Canada, other has an android. We can text for free.
    Facebook – I use this when I’m bored
    Simpsons Tapped Out – I’ve been a fan of the Simpsons since it started in the 80s.
    Words with Friends – Don’t play a ton, I’m losing interest I think
    Letterpress – Still fun
    Quintet – My friends Carmine’s game.
    Polymer – Fun addicting game
    Podcasts – I have a 1+ hr commute each way, I listen to a lot of podcasts.
    The Weather Channel – I like weather 😛
    NHL Game Center – Hockey is my favorite sport, LETS GO ISLANDERS!!
    MLB At Bat – Baseball is my second favorite sport, LETS GO METS!!
    ESPN Score Center – I check scores for the NFL and College Football

    Of course I have to include the Apps I have done:

    iLearn Math – Great math game for kids ages 4-9
    iLearn Math Lite – Free version, try it out!
    Multipli – The first app I made. I made this for my son who, at the time, was learning his multiplication tables.
    Awesome Cowbell – The best Cowbell app for iOS!
    Awesome Cowbell Free – Free version of the best Cowbell app

    iLearn Math v1.3

    An update to my game iLearn Math was just released! It includes a new app icon, a new unlockable theme, and an unlockable custom difficulty! The custom difficulty allows you to select a minimum number and a maximum number for practice a specific range of numbers!

    Its a FREE update to everyone who has it already. Everyone else can get the app for $1.99! Download it in the App Store now! iLearn Math

    iLearn Math Lite

    Just released tonight! The LITE version of my game, iLearn Math. In this version you can play the basic game but only unlock the beginner difficulty.

    The FULL version (99 cents) has 2 more difficulties and themes to unlock too! Give the free version a try and PLEASE rate the game.

    iLearn Math v1.2

    There is an update out for iLearn Math. I added a bunch of new features, here they are:

    The icon has been updated.

    I added 2 new UNLOCKABLE themes, one is a winter and the other is Holiday. They each include a background and 4 different icons.

    PARENTS/TEACHERS – Swipe LEFT on the CREDITS menu to reset ALL difficulties and themes to locked again. This also sets the coins to 0, and sets the highest streak to 0 as well.

    Added a RANDOM mode which still goes by the difficulty you selected but asks all of the math operations randomly.

    Added “Best Streak”.

    When you guess the right answer, the icon you selected will make a sound that it would make (except for the turtle).

    Added text at the bottom that says you have enough coins to unlock a difficulty or just more then 20 coins.

    You can not unlock a difficulty if the previous ones were not unlocked yet. For example, you won’t be able to unlock HARD if EASY was never unlocked.

    Let me know what you think!

    iLearn Math 1.1

    I released version 1.1 of iLearn Math. The game now supports the new iPhone 5/new iPod Touch screen. The icon has been redone. I added a Halloween theme with a new background, icons and sounds.

    The next update should come out soon which will include new unlockable themes!

    Introducing, iLearn Math

    So after a week and 2 days my game was finally reviewed and is ready for sale!
    The game is for kids who are learning and want to practice math. you can add, subtract, multiply or divide. There are 4 different difficulty levels as well. You start off with beginner and need to unlock the rest by earning coins. Earn coins by answering math problems correctly.The game also has a place where you can also change the background and even the icons. There will be updates where I will be adding more of both. I’ll also be adding game center compatibility with achievements and more unlockables.

    So check it out and let me know what you think!