iOS 8中的MFMailComposeViewController [英] MFMailComposeViewController in iOS 8

查看:103
本文介绍了iOS 8中的MFMailComposeViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我的应用在iOS 7上运行良好,因为iOS 8无法通过"MFMailComposeViewController"发送应用内电子邮件. 出现消息窗口,仅显示邮件主题,并在几秒钟内关闭. 我在这里找到了描述我的问题的线程,现在尝试实现"Joe Blow"的答案 https://stackoverflow.com/a/25864182/4061869

First, my app worked fine on iOS 7, since iOS 8 i can't send in-app email thru "MFMailComposeViewController". Message window comes up, only shows subject of the mail and closes within seconds. I found this thread here which describes my problem and now tried to implement the answer from "Joe Blow" https://stackoverflow.com/a/25864182/4061869

但是我遇到了一些错误,一些语义和解析问题.

But im getting some errors, some sematic and parse issues.

根据变通办法的这一部分,最糟糕的事情是:

Worst thing according to this part of the workaround:

Of course have this in your Prefix file

#define APP ((AppDelegate *)[[UIApplication sharedApplication] delegate])
// it's worth noting that is the delegate, not the "application"

导致此错误的原因:

使用未声明的标识符'AppDelegate'

Use of undeclared identifier 'AppDelegate'

谁知道问题出在哪里? 我根据appdelegat.h/.m的文件名在"AppDelegate"上尝试了不同的措词,但没有帮助.

Anyone knows where the problem can be? I tried different wordings on 'AppDelegate' according to my filename of the appdelegat.h/.m but nothing helps.

推荐答案

您可以使用以下方法在正在使用的任何ViewController中定义应用程序委托:

You can define the app delegate in whichever ViewController you are working in, by using:

AppNameAppDelegate *APP = [[UIApplication sharedApplication]delegate];

用AppName表示显而易见的意思是您的应用程序的名称.确保也将AppDelegate.h导入您的.m文件.

To state the obvious, by AppName I mean the name of your application. Make sure to import the AppDelegate.h into your .m file too.

#import "AppNameAppDelegate.h"

出于记录,我也遇到了与MFMailComposeViewController相同的问题,并且我尝试了您

For the record, I am also having the same issue with MFMailComposeViewController,and I have tried the method suggested in the post you linked (creating a global mail composer), but it still won't work for me using the iOS 8 simulator. Apparently it works on a physical device running iOS 8, but I personally cannot confirm that just yet.

这篇关于iOS 8中的MFMailComposeViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆