“Gift App” from inside the app

后端 未结 3 1116
难免孤独
难免孤独 2020-12-22 17:56

I noticed that on the latest angry birds update they added a feature to gift your app from inside the app.

Up till now I knew you can gift paid apps from the iTunes

相关标签:
3条回答
  • 2020-12-22 18:25

    Actually, you'll want your URL to start with itms-appss: if you want it to open in the App Store app, where someone would actually gift an app. This feels more natural than Safari popping up.

    // example app id for batman arkham city lockdown
    #define APP_ID 459850726
    
    NSString *GiftAppURL = [NSString stringWithFormat:@"itms-appss://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/giftSongsWizard?gift=1&salableAdamId=%d&productType=C&pricingParameter=STDQ&mt=8&ign-mscache=1",
                                    APP_ID];
    
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:GiftAppURL]];
    

    APP_ID should obviously be defined to the Apple ID of your app.

    Also worth noting, the URL is case sensitive.

    0 讨论(0)
  • 2020-12-22 18:34

    If you watch what happens when you click that button, you can see that it initially makes a request to a redirect script on www.angrybirds.com:

    http://www.angrybirds.com/redirect.php?device=iphone&product=angrybirds&type=purchasegift

    From there you are redirected to a secure url of the form:

    https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/giftSongsWizard?gift=1&salableAdamId=343200656&productType=C&pricingParameter=STDQ

    343200656 is the AppleID for Angry Birds.

    0 讨论(0)
  • 2020-12-22 18:38

    I have here some step-by-step instructions in how to add a 'Gift This App' button into your app:

    1. Add a button in your XIB and add an action to it.

    2. In your .m add the actions brackets e.g:

      -(IBAction)actionName {
      
      } 
      
    3. add this code in and replace APP_ID with the number in the apps web page link for e.g. itunes.apple.com/au/app/[APPNAME]/id**APP_ID**?mt=8

      this is a code e.g:

      - (IBAction)actionName 
      {
          [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/giftSongsWizard?gift=1&salableAdamId=**[APP_ID]**&productType=C&pricingParameter=STDQ"]];
      }
      

    Hope this helps!

    0 讨论(0)
提交回复
热议问题