MDMGiftAppActivity is a
UIActivity subclass that provides a "Gift App" action to a
On iOS 6 the user will be taken to the gifting dialog for the app on the App Store.
On iOS 7 the user is taken to the App Store page for the app. Once on the App Store page the user still has to tap on the action button in the top toolbar. Apple no longer allows linking directly to the gifting dialog.
pod 'MDMGiftAppActivity' to your Podfile or
pod 'MDMGiftAppActivity', :head if you're feeling adventurous.
Just drag the
glyphicons_069_gift[@2x].png files into your project.
Important note: If your project doesn't use ARC you must add the
-fobjc-arc compiler flag to
MDMGiftAppActivity.m in Target Settings > Build Phases > Compile Sources.
Important note: Demo does not work on the simulator as it does not contain the App Store app, you must test on a device. See example Xcode project in
MDMGiftAppActivity *giftAppActivity = [[MDMGiftAppActivity alloc] initWithAppID:@"XXXXXXXXX"];
An app ID can be found by opening iTunes and finding the app you want to link to. Right click on its icon then on ‘Copy Link’. For this example I’m using Buoy Explorer and the link looks like this:
https://itunes.apple.com/us/app/buoy-explorer-noaa-marine/id593296099?mt=8. The app ID for Buoy Explorer is
593296099. You can also find the App ID with the Apple Link Maker.
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[@"Awesome app"]] applicationActivities:@[giftAppActivity]]; [self presentViewController:activityViewController animated:YES completion:nil];
Add affiliate ID
MDMGiftAppActivity *giftAppActivity = [[MDMGiftAppActivity alloc] initWithAppID:@"XXXXXXXXX" withAffiliateToken:@"YYYYYY" withCampaignToken:@"ZZZZZZZ"];
Change activity title
giftAppActivity.titleOfActivity = @"Gift This App";
Change activity icon
giftAppActivity.iconOfActivity = [UIImage imageNamed:@"gift-icon"];
MDMGiftAppActivity is brought to you by Matthew Morey. The gift icon is from GLYPHICONS. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by creating new issues. If you're using MDMGiftAppActivity in your project, attribution would be nice.