使用Xcode编译iPhone应用程序会使手机死机

时间:2014-12-16 22:06:08

标签: ios iphone xcode

我有一个程序,我已经多次编译到iPhone 5但突然在我重新编译程序后,iPhone完全死了。 我已经尝试按下开启按钮超过30秒,无论是否按下主页按钮,但它已经死了。 有没有人知道之前发生过这种情况,有没有建议如何让手机恢复生机?

Edit2:是的,手机是黑屏,对按任何按钮都没有反应。

编辑:重新编译我只想再次编译。关于按下On和Home按钮,我的意思是在真实(死机)设备上尝试将其唤醒/重新启动它。手机已插入充电器并已满载。由于手机已关闭,因此无法删除该应用。关于代码示例,我在手机死机后使用了我的新Ipad,因此代码与手机问题发生时的代码不完全相同。项目中有更多VC,但是编辑此部分时出现了问题。 如果您认为这可能是一个原因,我想我可能已经忘记了mailMessage2合成中最后两个字符串之间的+符号。

import Foundation
import UIKit
import MessageUI

var mailSubject = String()
var mailMessage1 = String()
var mailMessage2 = String()
var mailMessage3 = String()
var mailMessage4 = String()

class KundData: UIViewController, MFMailComposeViewControllerDelegate {

    @IBOutlet weak var tfKundNamn: UITextField!
    @IBOutlet weak var tfKontaktPerson: UITextField!
    @IBOutlet weak var tfKundNummer: UITextField!
    @IBOutlet weak var tfTelefon: UITextField!
    @IBOutlet weak var tfEmail: UITextField!
    @IBOutlet weak var tfSlutkund: UITextField!

    var salesPersons = ["Sales engineer", "PersonA", "PersonB", "PersonC", "PersonD", "PersonE", "PersonF"]
    @IBOutlet weak var salesPerson: UITextField!
    @IBOutlet weak var salesIndex: UIStepper!

    @IBAction func salesStepper(sender: UIStepper) {
        salesPerson.text = salesPersons[Int(sender.value)]
    }


    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.salesIndex.wraps = true
        self.salesIndex.autorepeat = true
        self.salesIndex.maximumValue = Double(salesPersons.count - 1)

        var value = Int(self.salesIndex.value)
        self.salesPerson.text = salesPersons[value]
    }

    // Gör att keyboardet försvinner när man pekar nånstans i vyn som inte är views
    override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
        self.view.endEditing(true)
    }

    @IBAction func sendEmailButtonTapped(sender: AnyObject) {
        let mailComposeViewController = configuredMailComposeViewController()
        if MFMailComposeViewController.canSendMail() {
            self.presentViewController(mailComposeViewController, animated: true, completion: nil)
        } else {
            self.showSendMailErrorAlert()
        }
    }

    func configuredMailComposeViewController() -> MFMailComposeViewController {
        let mailComposerVC = MFMailComposeViewController()
        mailComposerVC.mailComposeDelegate = self // Extremely important to set the --mailComposeDelegate-- property, NOT the --delegate-- property

        mailSubject = "Förfrågan från \(tfKundNamn.text), \(tfKontaktPerson.text)"
        mailMessage1 = "Kund: \(tfKundNamn.text)\n" +
        "Kundnummer: \(tfKundNummer.text)\n" +
        "Kontaktperson: \(tfKontaktPerson.text)\n"

        mailMessage2 = "Telefon: \(tfTelefon.text)\n" +
        "Email: \(tfEmail.text)\n" +
        "Slutkund: \(tfSlutkund.text)\n" +
        "Försäljare: \(salesPerson.text)\n"

        mailComposerVC.setToRecipients(["kim.jerkhagen@flexlink.com"])
        mailComposerVC.setSubject(mailSubject)
        mailComposerVC.setMessageBody(mailMessage1 + mailMessage2 + mailMessage3 + mailMessage4, isHTML: false)

        return mailComposerVC
    }

    func showSendMailErrorAlert() {
        let sendMailErrorAlert = UIAlertView(title: "Could Not Send Email", message: "Your device could not send e-mail.  Please check e-mail configuration and try again.", delegate: self, cancelButtonTitle: "OK")
        sendMailErrorAlert.show()
    }

    // MARK: MFMailComposeViewControllerDelegate Method
    func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!) {
        controller.dismissViewControllerAnimated(true, completion: nil)
    }


    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

1 个答案:

答案 0 :(得分:0)

如果您的iPhone死了,您可以按照以下步骤操作   https://www.youtube.com/watch?v=NKFFFe0r-T4