iOS:通过电子邮件,短信或Facebook邀请朋友

ben*_*lis 2 iphone facebook ipad ios

我想在我的应用程序中添加一个邀请朋友屏幕.理想情况下,我想通过电子邮件,短信或Facebook支持邀请(类似于路径).

邀请将只是通知用户应用程序存在的消息以及指向App Store的链接以进行下载.

有没有一个开源库可以做这样的事情?另外,任何人都可以推荐任何有用的教程吗?

路径

P

Vin*_*ent 7

我在本书中找到了一些信息."iPhone和iPad应用开发业务:制作和营销应用".第5章,社交启动:使用应用程序推广您的应用程序.在本章中,它提到了电子邮件和Facebook.

至于SMS,它很容易实现,这里有一些示例代码.

    MFMessageComposeViewController *smsController = [[MFMessageComposeViewController alloc] init];
    smsController.messageComposeDelegate = self;
    smsController.body = @"check out apps, link";
    [self presentModalViewController:smsController animated:YES];
    [smsController release];
Run Code Online (Sandbox Code Playgroud)

电子邮件的样本代码:

MFMailComposeViewController *mcvc = [[MFMailComposeViewController alloc] init];
mcvc.mailComposeDelegate = self;
[mcvc setSubject:@"Check out this app"];
UIImage *image = [UIImage imageNamed:@"Icon"]; 
//include your app icon here
[mcvc addAttachmentData:UIImageJPEGRepresentation(image, 1) mimeType:@"image/jpg" fileName:@"icon.jpg"]; 
// your message and link
NSString *defaultBody =@"check out this cool apps, link...."
[mcvc setMessageBody:defaultBody isHTML:YES];
[self presentViewController:mcvc animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

对于Facebook来说,它有点复杂.你必须使用facebook SDK并引用他们的文档.http://developers.facebook.com/ios/

NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:@"This is a great apps, link..." forKey:@"message"];
[facebook requestWithGraphPath:@"me" andParams:dict andHttpMethod:@"POST" andDelegate:self];
Run Code Online (Sandbox Code Playgroud)