Need to verify receipt for IAP?

Discussion in 'iOS Programming' started by ArtOfWarfare, Sep 8, 2011.

  1. ArtOfWarfare, Sep 8, 2011
    Last edited: Sep 8, 2011

    ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #1
    I've made an app with an IAP, but currently it does nothing with the receipt other than store it in NSUserDefaults.

    Correct me if I'm wrong, but the contents of NSUserDefaults can be manipulated on jailbroken iPhones, right? So, were my app to be installed on a jailbroken iPhone, they could put in a phony NSData object with the correct key in the NSUserDefaults, and my app wouldn't know the difference.

    So, I figure that in addition to checking that any data is stored with the key for the NSUserDefaults, I need to verify that the data is for a valid receipt.

    Apple's documentation on the subject may just have left more questions than answers... first, here's the documentation:
    http://developer.apple.com/library/...html#//apple_ref/doc/uid/TP40008267-CH104-SW1

    My questions:
    1.) How do I encode with base64 encoder? I looked through the information on NSCoder and I didn't see anything about base64.
    2.) How do I create a JSON object?
    3.) How do I post it?
    4.) Where is Apple's response going to appear? Should establish a delegate and give it a method to handle Apple's response?

    ... maybe it'd be better if I just found documentation on using JSON on the iPhone... I suspect questions 2-4, if not 1, could be answered by it if it exists...
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    Those two questions are easily answered by google.

    If you don't know what base64 or JSON is, then try searching Wikipedia.
     
  3. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #3
    http://cl.ly/2m1Z0V0v1e0Y3k0R2a3B

    These are the Base64 Classes you need (this isn't build in on iOS, but is on Mac OSX).
    Then you need to format the string to Base64 Encrypting with those classes. Play around a bit, and good luck.
     

Share This Page