我是iOS开发的新手,我遇到了创建“联系我们”按钮的问题。 我已经按照一些关于如何在我的应用程序中包含发送电子邮件操作的教程,我已经正确完成了所有操作并将所有内容添加到我的应用程序中,但它只是无法在XCode中给我以下消息:
2017-08-16 21:59:51.919774+0300 KurdishGuardSecurity[460:64579] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-08-16 21:59:51.921951+0300 KurdishGuardSecurity[460:64579] [MC] Reading from public effective user settings.
2017-08-16 21:59:52.180335+0300 KurdishGuardSecurity[460:64653] 0x170155b30 Copy matching assets reply: XPC_TYPE_DICTIONARY <dictionary: 0x170155b30> { count = 1, transaction: 0, voucher = 0x0, contents =
"Result" => <int64: 0x170227860>: 29
}
2017-08-16 21:59:52.181586+0300 KurdishGuardSecurity[460:64653] 0x170156e70 Daemon configuration query reply: XPC_TYPE_DICTIONARY <dictionary: 0x170156e70> { count = 2, transaction: 0, voucher = 0x0, contents =
"Dictionary" => <dictionary: 0x1701564d0> { count = 1, transaction: 0, voucher = 0x0, contents =
"ServerURL" => <dictionary: 0x170155f50> { count = 3, transaction: 0, voucher = 0x0, contents =
"com.apple.CFURL.magic" => <uuid: 0x17025c740> C3853DCC-9776-4114-B6C1-FD9F51944A6D
"com.apple.CFURL.string" => <string: 0x170252060> { length = 30, contents = "https://mesu.apple.com/assets/" }
"com.apple.CFURL.base" => <null: 0x1a3276e80>: null-object
}
}
"Result" => <int64: 0x1702248e0>: 0
}
2017-08-16 21:59:52.181819+0300 KurdishGuardSecurity[460:64653] [MobileAssetError:29] Unable to copy asset information from https://mesu.apple.com/assets/ for asset type com.apple.MobileAsset.TextInput.SpellChecker
2017-08-16 22:10:40.384670+0300 KurdishGuardSecurity[460:66842] [MC] Invalidating cache
2017-08-16 22:10:40.389685+0300 KurdishGuardSecurity[460:66843] [MC] Invalidating cache
2017-08-16 22:10:40.400291+0300 KurdishGuardSecurity[460:64579] [MC] Reading from public effective user settings.
这个问题仍然存在,即使我没有文本字段或整个应用程序中的任何内容我已经阅读了有关此问题的一些主题,并且他们都有文本字段,他们通过禁用拼写检查功能解决了问题,我也尝试了启动一个全新的应用程序,只测试我的代码是否正常发送电子邮件,它是否有另一个应用程序只有一个按钮,执行“联系我们”操作代码,它完美的工作,但它只是不适用于我的当前的应用程序,任何建议?
这是我使用的ViewController.swift代码:
import UIKit
import MessageUI
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func contactMe(_ sender: Any) {
self.sendEmail()
}
}
extension ViewController:MFMailComposeViewControllerDelegate{
func sendEmail(){
let mailVC = configureMainComposeViewController()
if MFMailComposeViewController.canSendMail(){
self.present(mailVC, animated: true, completion: nil)
}
}
private func configureMainComposeViewController()->MFMailComposeViewController{
let mailVC = MFMailComposeViewController()
mailVC.mailComposeDelegate = self
mailVC.setToRecipients(["info@kurdishguard.com"])
return mailVC
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
print("Sent Mail",result)
controller.dismiss(animated: true, completion: nil)
}
}
任何帮助都会受到赞赏,因为我已经在这个应用程序上工作了几个月,我不想因为单个按钮的动作而重新开始。