Hiding Ads From Previously Paid Users in Closeby

Although as a paid app Closeby didn’t have a ton of users, I wanted to do my best when taking it free with iAds to not show the ads to those to people who had paid for it. Luckily, I have a file I that I write out, so I can detect if the app has been run on the current device by checking if that file exists or not and saving something in NSUserDefaults. The problem is that if the user bought a new device, or is installing it on a second device that hadn’t run the app before, they’d be out of luck.

What I wanted was a way to not show ads if the user had ever run the app on any of their devices, and to never show them ads later if they bought a new device. I think the solution I came up with is pretty clever, really easy, and solves the problem the way I wanted to. What I do is when I check if that file exists, I don’t just note it in user defaults, I save it using the iCloud key/value store. I can then check that whenever the app launches.

As long as the user has run the previous version of the app, upgraded, and ran the Closeby again on any of their devices, ads will be hidden on all of their devices forever.

Collin Donnell @collin