小编Cha*_*hal的帖子

电子邮件沉着的iOS 8

我正试图从Xcode 6开始在iOS 8中打开电子邮件,但收到错误.如果我从Xcode 5尝试,相同的代码工作正常.后来我从apple开发人员门户网站下载了一个示例代码:

https://developer.apple.com/library/content/samplecode/MessageComposer/Introduction/Intro.html

但结果是一样的.有什么东西,或某些设置,我缺少优化Xcode 6的代码

这是代码:在我的按钮操作中

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];

picker.mailComposeDelegate = self;

[picker setSubject:@"Hello from California!"];

// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"]; 
NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil]; 
NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"]; 

[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];  
[picker setBccRecipients:bccRecipients];

// Attach an image to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"jpg"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"rainy"];

// Fill out the email body text
NSString *emailBody …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c ios ios8 xcode6gm

51
推荐指数
1
解决办法
2万
查看次数

标签 统计

ios ×1

ios8 ×1

objective-c ×1

xcode ×1

xcode6gm ×1