小编Đor*_*vić的帖子

重新激活活动后进行调试

在活动因系统限制而被销毁后再次重新创建,是否可以在Eclipse中继续调试,但同时在设备上使用另一个应用程序.

因此,例如:我开始调试,在app中执行某些操作,然后按home键并调用onSaveInstanceState.如果我按住主页按钮我会在那里有我的应用程序,如果我按下图标,应用程序将继续,调试将工作.但是,如果我从退出后进入另一个应用程序,调试将不再起作用.(我这样做是为了干掉内存源,所以当我继续使用我的应用程序活动时,将重新激活并调用onRestoreInstanceState)

java eclipse debugging android

5
推荐指数
1
解决办法
54
查看次数

MFMailComposeViewController,Swift 4,Xcode 9

我有MFMailComposeViewControllerDelegate函数的问题.

func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
    controller.dismiss(animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

警告说

实例方法'mailComposeController(:didFinishWith:error :)'几乎匹配协议'MFMailComposeViewControllerDelegate'的可选要求'mailComposeController(:didFinishWith:error :)'

将'mailComposeController(_:didFinishWith:error :)'私有化以使此警告无声

我需要将用户返回到App并在单击取消后关闭MFMailComposeViewController并且不会触发此功能.

是的,我添加了代表 composeVC.mailComposeDelegate = self

如果有人有类似的问题,我将不胜感激.谢谢

编辑

只有当我将语言设置为Swift 4时才会发生这种情况.我只是回过头几次提交,并且它与Swift 3.2完全正常工作

基本上,这是代码:

class TechSupportVC: UIViewController, MFMailComposeViewControllerDelegate {
    let composeVC = MFMailComposeViewController()

override func viewDidLoad() {
    super.viewDidLoad()

    composeVC.mailComposeDelegate = self
    composeVC.setToRecipients(["desiredEmail@gmail.com"])
    composeVC.setSubject("My message")
}

func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
    controller.dismiss(animated: true, completion: nil)
}

@IBAction func sendPressed(_ sender: Any) {
    guard …
Run Code Online (Sandbox Code Playgroud)

xcode ios swift mfmailcomposeviewcontroller

3
推荐指数
1
解决办法
5697
查看次数