App store 拒绝了我的应用程序崩溃,但它从未通过大量测试为我崩溃
App store Rejected me from the app crashing but it has never crashed for me through numerous testing
我将我的应用程序提交到应用程序商店,但他们拒绝了它,说当他们单击反馈按钮时应用程序崩溃了,该按钮是一个打开 MFMailComposeViewController 的按钮。我遇到的问题是我在模拟器和实际设备之间的许多设备上都有 运行 它,但我从来没有遇到过这个问题。我将 post 我在下面调用的反馈按钮的功能,并且都连接到该按钮(就像我说的,每次我测试它时它都工作得很好),我的问题是:我在做某事吗代码错误到只有他们崩溃的地方?
func giveFeedback()
{
let email = ["info@website.com"]
var fvc = view?.window?.rootViewController
var cev = MFMailComposeViewController()
cev.mailComposeDelegate = self
cev.setToRecipients(email)
cev.setSubject("MyApp")
fvc?.presentViewController(cev, animated: true, completion: nil)
}
func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!)
{
controller.dismissViewControllerAnimated(true, completion: nil)
}
此外,我已经导入了 MessageUI
,并且在 class 中我有我的 MFMailComposeViewControllerDelegate
好吧,我也得猜....有两件事对我来说很可疑...第一件事是线
var fvc = view?.window?.rootViewController
你能改成这样吗?
func giveFeedback(contextViewController: UIViewController) {
let email = ["info@website.com"]
var cev = MFMailComposeViewController()
cev.mailComposeDelegate = self
cev.setToRecipients(email)
cev.setSubject("MyApp")
contextViewController.presentViewController(cev, animated: true, completion: nil)
}
一件事是你不打电话给 canSendMail。我相信,如果您在禁用邮件时尝试显示 MFMailComposeViewController,您的应用程序将会崩溃。
在您的函数中,您可以像这样使用它:
func giveFeedback(contextViewController: UIViewController) {
if MFMailComposeViewController.canSendMail() {
let email = ["info@website.com"]
var cev = MFMailComposeViewController()
cev.mailComposeDelegate = self
cev.setToRecipients(email)
cev.setSubject("MyApp")
contextViewController.presentViewController(cev, animated: true, completion: nil)
}
}
但是最好早点检查状态并仅在设备上启用电子邮件时才显示按钮...
我将我的应用程序提交到应用程序商店,但他们拒绝了它,说当他们单击反馈按钮时应用程序崩溃了,该按钮是一个打开 MFMailComposeViewController 的按钮。我遇到的问题是我在模拟器和实际设备之间的许多设备上都有 运行 它,但我从来没有遇到过这个问题。我将 post 我在下面调用的反馈按钮的功能,并且都连接到该按钮(就像我说的,每次我测试它时它都工作得很好),我的问题是:我在做某事吗代码错误到只有他们崩溃的地方?
func giveFeedback()
{
let email = ["info@website.com"]
var fvc = view?.window?.rootViewController
var cev = MFMailComposeViewController()
cev.mailComposeDelegate = self
cev.setToRecipients(email)
cev.setSubject("MyApp")
fvc?.presentViewController(cev, animated: true, completion: nil)
}
func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!)
{
controller.dismissViewControllerAnimated(true, completion: nil)
}
此外,我已经导入了 MessageUI
,并且在 class 中我有我的 MFMailComposeViewControllerDelegate
好吧,我也得猜....有两件事对我来说很可疑...第一件事是线
var fvc = view?.window?.rootViewController
你能改成这样吗?
func giveFeedback(contextViewController: UIViewController) {
let email = ["info@website.com"]
var cev = MFMailComposeViewController()
cev.mailComposeDelegate = self
cev.setToRecipients(email)
cev.setSubject("MyApp")
contextViewController.presentViewController(cev, animated: true, completion: nil)
}
一件事是你不打电话给 canSendMail。我相信,如果您在禁用邮件时尝试显示 MFMailComposeViewController,您的应用程序将会崩溃。
在您的函数中,您可以像这样使用它:
func giveFeedback(contextViewController: UIViewController) {
if MFMailComposeViewController.canSendMail() {
let email = ["info@website.com"]
var cev = MFMailComposeViewController()
cev.mailComposeDelegate = self
cev.setToRecipients(email)
cev.setSubject("MyApp")
contextViewController.presentViewController(cev, animated: true, completion: nil)
}
}
但是最好早点检查状态并仅在设备上启用电子邮件时才显示按钮...