How can I link to my app in the App Store (iTunes)?

前端 未结 5 1528
遇见更好的自我
遇见更好的自我 2020-11-29 16:24

I want to have a feature in my app where the user can send an email to a friend with the iTunes URL to my application. How is it possible?

Thanks.

5条回答
  •  渐次进展
    2020-11-29 16:59

    This code generates the app store link automatically based on the app name, nothing else is required, drag & drop:

    NSCharacterSet *trimSet = [[NSCharacterSet characterSetWithCharactersInString:@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLKMNOPQRSTUVWXYZ0123456789"] invertedSet];    
    NSArray *trimmedAppname = [[NSString stringWithString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]] componentsSeparatedByCharactersInSet:trimSet];
    NSString *appStoreLink = @"http://itunes.com/app/"; 
    for (NSString *part in trimmedAppname) appStoreLink = [NSString stringWithFormat:@"%@%@",appStoreLink,part];
    NSLog(@"App store URL:%@",appStoreLink);
    

    It gives you a link like http://itunes.com/app/angrybirds

提交回复
热议问题