Reputation: 1435
I am using the following code to share to share some text through UIActivityViewController.
NSString *appUrlAppStore = @"https://itunes.apple.com/app/imdb-movies-tv/id342792525";
NSString *appUrlPlayStore = @"https://play.google.com/store/apps/details?id=com.imdb.mobile";
NSString *textToShare = [NSString stringWithFormat:@"Hey, this is an Awesome app and you can get this from App Store : %@ Play Store : %@", appUrlAppStore ,appUrlPlayStore];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[textToShare] applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll];
[self presentViewController:activityVC animated:YES completion:nil];
Now the problem is that which ever link is first (like in the above App Store one) whats app takes the thumbnail of that link
What i want is that if the device is an ios one it should pick the appStore one and of its Android it should pick the play store one.
I do get it that this is the default behavior of WhatsApp but what would be the solution for my problem. Or if most app do behave like this than I guess my users won’t mind as well.
or is there any key thing that i am missing.
Any comments are appreciated.
Upvotes: 0
Views: 134
Reputation: 3417
Use can use branch.io to generate one link for iOS and android also can track links. Branch.io provides deep links with referral systems, sharing links, invites and marketing links with full attribution and analytics. You can refer branch.io for SDK integration or for more simple you can refer branch.io Git repo for integration.
Replace your UIActivityViewController with this code.
BranchUniversalObject *branchUniversalObject = [[BranchUniversalObject alloc] initWithCanonicalIdentifier:@"user_id"];
branchUniversalObject.title = @"Hey, this is an Awesome app and you can get this from App Store";
branchUniversalObject.contentDescription =[NSString stringWithFormat:@"%@ %@ %@",@"Your friend",user_name,@"has invited you to download awesome App"];
branchUniversalObject.imageUrl = @"APP_Image_url";
BranchLinkProperties *linkProperties = [[BranchLinkProperties alloc] init];
linkProperties.feature = @"share";
linkProperties.channel = @"WhatsApp";
[branchUniversalObject showShareSheetWithLinkProperties:linkProperties
andShareText:@"Super amazing App I want to share!"
fromViewController:self
andCallback:^{
NSLog(@"finished sharing link");
}];
Upvotes: 1