标签: mfmailcomposeviewcontroller

在iPhone sdk中问题MFMessageComposerViewController

我正在尝试实现一个SMS应用程序.当我试图发送我的短信时,我在[self.navigationController presentModalViewController:picker animated:YES];中得到了一个异常.我对此很新.你能帮帮我吗?我的代码如下.

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.delegate = self;

picker.recipients = [NSArray arrayWithObject:@"123456789"]; // your recipient number or self for testing
picker.body = @"test from OS4";

[self.navigationController presentModalViewController:picker animated:YES];
[picker release];
Run Code Online (Sandbox Code Playgroud)

我的日志消息如下,

 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target <UINavigationController: 0x5b2c120>.
Run Code Online (Sandbox Code Playgroud)

在此先感谢,S.

iphone mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
1239
查看次数

从uitableview填充电子邮件正文的最佳方法

好吧,让我试着把它变成一个更好的问题.

我的应用程序中有一个tableViewController,其中包含一些用户希望通过tableview通过电子邮件向某人发送电子邮件的信息.

我可以保留一个包含该信息的数组.

问题的难点部分是如何使用Objective-c语言使用tableview中的数据填充消息正文?

我是否必须制作一个包含所有HTML代码的大字符串?或者有更好/更简单的方法吗?即使它只是一个简单的表,所以客户端会将其发送给某人.

我想任何解决方案/建议都可以成为一个很好的方法,让我知道如何使用它.

xcode core-data uitableview mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
2824
查看次数

发送短信iPhone

我试图从我的应用程序内发送短信.我写了这段代码,但似乎没有用.没有崩溃,没有错误日志,根本没有发生任何事情(当然我试图记录canSendText,结果是1).

- (void)viewDidLoad
{
    [super viewDidLoad];

    messageComposer = [[MFMessageComposeViewController alloc] init];

    if ([MFMessageComposeViewController canSendText]) {

        [messageComposer setBody:@"Messaggio generato da SMSTest"];
        [messageComposer setRecipients:[NSArray arrayWithObject:@"3333333333"]];
        [messageComposer setDelegate:self];

        [self presentModalViewController:messageComposer animated:YES];
    }
}
Run Code Online (Sandbox Code Playgroud)

谁能解释一下我做错了什么?

iphone sms cocoa-touch mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
677
查看次数

MFMailComposeViewController:主题/文本不可编辑?

我需要开发一个能够发送带有自动内容(主题/文本)的邮件的应用程序,该邮件不应允许用户编辑。有可能吗?

感谢您的建议

email objective-c ios mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
964
查看次数

将CSV文件附加到电子邮件目标 - C的问题

我正在使用以下IBAction将包含一些简单收据数据的CSV文件附加到电子邮件中,但是当电子邮件编辑器视图打开时,正文部分中会显示一个灰色文件,当我实际发送邮件时消息发送时根本没有附件.

继承我的代码:

    - (IBAction)actionEmailComposer {
    NSLog(@"Receipts Count: %d", [receipts count]);
    //Create CSV File
    NSMutableString *csvString = [[NSMutableString alloc] init];
    [csvString appendString:@"Date,Business,Category,Paid By,Note, Number,Currency, Amount"];

    for (int i = 0; i < [receipts count]; i++){

        [csvString appendString: [[receipts objectAtIndex:i] receiptDate]];
        [csvString appendString: [[receipts objectAtIndex:i] business]];
        [csvString appendString: [[receipts objectAtIndex:i] category]];
        [csvString appendString: [[receipts objectAtIndex:i] paidBy]];
        [csvString appendString: [[receipts objectAtIndex:i] note]];
        [csvString appendString: [[receipts objectAtIndex:i] number]];
        [csvString appendString: [[receipts objectAtIndex:i] currency]];
        [csvString appendString: [[receipts objectAtIndex:i] amount]];

    }

    [csvString writeToFile:@"test.csv" atomically:YES encoding:NSUTF8StringEncoding error:NULL]; …
Run Code Online (Sandbox Code Playgroud)

csv iphone objective-c ios mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
2255
查看次数

如何将CGPDFDocument/CGPDFPage附加到MFMailComposeViewController

我有一个存储在本地存储上的多页PDF文档.我想从该pdf文档中提取任何页面并将其转换为NSData以将其附加到"MFMailComposeViewController".使用以下代码行,我可以轻松地检索所需的页面...

CGPDFDocumentRef pdfDoc=CGPDFDocumentCreateWithURL(pdfURL);
CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfDoc, pageNumber);
Run Code Online (Sandbox Code Playgroud)

但我无法找到转换pdfPage成的方式,NSData以便我可以用邮件附加它.

注意:要求是以PDF格式附加页面,因此请不要建议将PDF转换为PNG或JPEG.

core-graphics nsdata cgpdfdocument ios mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
2884
查看次数

Ios MFMailComposeViewController没有移位

我试图编写rhodes本机扩展扩展来打开iOS MailComposer.现在代码"工作",但MFMailComposeViewController没有显示,xcode显示警告:

Attempt to present <MFMailComposeViewController: 0x12b60840> on <Iosmailto: 0xc1898d0> whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)

我读到UIViewControllers必须在层次结构中,但我不能从Rhodes ruby​​代码或clear-C扩展包装器中提供.现在我正在尝试使用来自[UIApplication sharedApplication] .keyWindow.rootViewController的MFMailComposeController呈现我的UIViewController,但邮件编辑器尚未显示.

来自iosmailto.h的界面:

@interface Iosmailto : UIViewController<MFMailComposeViewControllerDelegate>
{
}
    @property(nonatomic, assign) id delegate;
    //-(IBAction)send_mail:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)

从iosmailto.m实现:

@implementation Iosmailto

    - (void)viewDidLoad {
        [super viewDidLoad];
        [self send_mail];
    }

    - (void)send_mail {
        if ([MFMailComposeViewController canSendMail]) {

            MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
            composer.mailComposeDelegate = self;
            [composer setSubject:[NSString stringWithUTF8String:subj]];

            NSArray *recipients_array = [NSArray arrayWithObject:[NSString stringWithUTF8String:recipients]]; …
Run Code Online (Sandbox Code Playgroud)

iphone uiviewcontroller rhomobile ios mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
2676
查看次数

在iOS应用中发送电子邮件

我希望能够构建一个简单的电子邮件客户端来发送电子邮件.

我查看了使用MessageUI框架构建电子邮件客户端的IOS编程101教程,但我想在我的应用程序中实现的内容略有不同.

我想要实现的是,当我按下按钮时,预先组合的电子邮件(将由我编写,例如,像YOLO一样)将直接发送给收件人.

无论如何我能做到这一点吗?

PS:我根本不需要Mail ComposeViewController,只是一个发送预合成邮件的简单按钮.

非常感谢

问候

email-integration objective-c ios swift mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
8329
查看次数

应用程序按钮打开电子邮件,但不会关闭窗口并返回应用程序

我的应用程序中有一个按钮,打开一封要发送给我的电子邮件,当按下此按钮时,iPhone上的电子邮件应用程序打开,按下发送后发送电子邮件,但窗口没有关闭,然后返回到我的应用.此外,当我按下取消时,它提供了保存/删除草稿的选项,但再次没有关闭窗口并返回到我的应用程序.我已在下面附上电子邮件代码.

@IBAction func SendMessage(sender: AnyObject) {

var mail: MFMailComposeViewController!

let toRecipients = ["usalim76@gmail.com"]
let subject = "Enquiry"
let body = "Your body text"

mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(toRecipients)
mail.setSubject(subject)
mail.setMessageBody(body, isHTML: true)

presentViewController(mail, animated: true, completion: nil)

func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
  controller.presentingViewController?.dismissViewControllerAnimated(true, completion: nil)
}


}
Run Code Online (Sandbox Code Playgroud)

email ios swift mfmailcomposeviewcontroller

0
推荐指数
1
解决办法
734
查看次数