how to determine the first time an app is run

Discussion in 'iOS Programming' started by beachdog, Nov 24, 2008.

  1. macrumors member

    Joined:
    Aug 10, 2008
    #1
    Hold on...my question isn't as simple as it sounds...

    I want to know the *very first time* that a user runs my app after downloading it. If they delete it from their phone and then resync with their iTunes, I don't want to treat that as "the first time". And if they delete it from their device and iTunes, and go back and purchase it again, I *do* want that to qualify as *the very first time*.

    Basically, I have a promotional offer I only want to extend once.

    I also have a server piece involved, so if you can propose a solution that involves any sort of server-side requirement, that would be workable.

    Any ideas?...
     
  2. macrumors newbie

    Joined:
    Nov 10, 2008
    #2
    You could save out a flag to the Standard User Defaults.

    NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
     
  3. thread starter macrumors member

    Joined:
    Aug 10, 2008
    #3
    Thanks. But won't the user defaults for the app get destroyed when the app is deleted from the phone? And then if he re-syncs with his iTunes (assuming he did not remove it from iTunes), the next time he runs the app I would check the user defaults and determine, incorrectly, that this was the first time he'd run the app?
     
  4. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
  5. thread starter macrumors member

    Joined:
    Aug 10, 2008
    #5
    By UID do you mean the unique device identifier (the 40-character hex value)? I agree that needs to be part of the solution, and it addresses the case where he deletes the app and then resyncs with iTunes, but what of the case where he does in fact purchase a second instance from the app store? I want to give him the promotional benefit in that case as well, which I won't if I am only tracking that device uniqueness. In other words, I don't want to give the benefit only once per device, I want to give it once per purchase.
     
  6. macrumors regular

    Joined:
    Jun 18, 2008
    #6
    How do you think that someone could purchase a second instance of your app for a single iPhone?
     
  7. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #7
    http://developer.apple.com/iphone/l...apple_ref/occ/instp/UIDevice/uniqueIdentifier

    Assuming that person pays for a new version (existing versions would just be re-downloaded at no charge), then all you need to do is track the version AND UDID combination on your server to qualify the user.
     
  8. macrumors 65816

    Joined:
    Jun 29, 2007
    #8
    I plan on knowing how you plan on giving a discount...
     
  9. macrumors 6502

    Joined:
    Sep 17, 2003
    #9
    Indeed. I don't think Apple would be very happy with this, to be perfectly honest. They'll probably want all users created equally. Unless the app is passing off to another service which you charge for?
     
  10. macrumors member

    Joined:
    Apr 9, 2008
    #10
    Well the only way he can accomplish this is by using another iPhone, meaning another UUID, but even there, he would need to use another account. When you download an app from the Appstore, it "knows" the user it download it, so I can download the app as many times as I want, and I will not be charged every time. Unless I use a different user.
     
  11. thread starter macrumors member

    Joined:
    Aug 10, 2008
    #11
    Thanks for all the feedback and suggestions. I'm starting to think that what I want to do isn't possible, but let me back up and try to do a better job of describing the problem I am trying to solve.

    I want to sell an app which provides a type of communication service, in concert with a server application that I manage. As part of the initial purchase of my app, the user will also get X minutes of usage of this communication service. After the X minutes runs out, they will need to purchase a "minutes refill". Now, clearly the typical approach would be to drive them go to a web site I provide where they would signup and purchase add'l minutes through a credit card or paypal. That may be the way I go, but I would much prefer if I could simply sell them these additional minutes through iTunes. The question is, is this possible and if so by what means

    Thus, I had thought one approach would be to sell a second product which is simply a minutes refill -- the user purchases and downloads it, runs it once and it communicates with my server and puts more minutes in their account. This is what led me to the original question of how I would prevent them from running that app more than once (i.e., can an app be "disposable"). And secondly, it also begs the question some of you have raised, how can I also allow the user to purchase a second instance of the same product to get a second refill later.

    Does Apple provide any way of handling a sale like this? To me, it's completely analagous to selling razors and blades -- I want to sell both through iTunes if possible, not just the razors.
     
  12. macrumors 65816

    Joined:
    Jun 29, 2007
    #12
    No, you will have to do it from your website.
     
  13. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #13
    Read the app store guidelines. You can't sell "blades" (successive identical purchases to the same user). Every app sale is to a user, and they can then use the purchased app on as many devices as they have access to.

    It does appear that you can give away an app for a commercial subscription web service, and limit each subscription to a device UDID. You will have to figure out another way to collect your subscription payments though, as the App store only collects for the app.

    .
     
  14. thread starter macrumors member

    Joined:
    Aug 10, 2008
    #14
    Appreciate the heads up. Oh well, at least the path is clear at this point:eek:

    Appreciate the feedback from all on this thread.
     

Share This Page