不能 运行 应用程序只能在模拟器上运行

Can't run app on anything but simulator

当我 运行 我的应用程序在我的设备上构建时,应用程序崩溃了。我正在使用 swift 2,并且我正在 运行 将其安装在 iPhone 6 上。它以前工作但当我尝试添加保存选项时它开始崩溃。我删除了对保存选项的所有引用,但它仍然崩溃。我可以 运行 在模拟器上使用该应用程序,但不能在设备上使用。正如我昨天所说,我可以在我的 phone 上 运行 它。这是我得到的错误:

dyld: Library not loaded: @rpath / libswiftCore.dylib
Referenced from: /var/mobile / Containers / Bundle / Application / 0ACE5D12 - 6145 - 4C43 - B829 - C103E7016489 / CmdCombinerNew.app / CmdCombinerNew
Reason: no suitable image found.Did find:
  /private/var / mobile / Containers / Bundle / Application / 0ACE5D12 - 6145 - 4C43 - B829 - C103E7016489 / CmdCombinerNew.app / Frameworks / libswiftCore.dylib: mmap() errno = 1 validating first page of '/private/var/mobile/Containers/Bundle/Application/0ACE5D12-6145-4C43-B829-C103E7016489/CmdCombinerNew.app/Frameworks/libswiftCore.dylib' (lldb)

这是我使用的代码:

//
//  ViewController.swift
//  CmdCombinerNew
//
//  Created by Mathew Anderson on 2/2/16.
//  Copyright © 2016 Mathew Anderson. All rights reserved.
//

import UIKit

class ViewController: UIViewController, UIPopoverPresentationControllerDelegate {


    //create the variables for the text views
    @IBOutlet var FirstBlock: UITextField!
    @IBOutlet var SettingsButton: UIButton!
    @IBOutlet var SecondBlock: UITextField!
    @IBOutlet var ClockingCommands: UITextView!
    @IBOutlet var InitialCommands: UITextView!
    @IBOutlet var generateButton: UIButton!
    @IBOutlet var OutputCommand: UITextView!
    override func viewDidLoad() {
        super.viewDidLoad()

        //replace the text in first & second block with random numbers [0][1][2][3][4]
        let num1 = arc4random_uniform(15) + 1
        let num2 = arc4random_uniform(15) + 1
        OutputCommand.hidden = true;
        FirstBlock.text = "stained_hardened_clay " + String(num1)
        SecondBlock.text = "stained_glass " + String(num2)

        //Make things fancy!!!
        ClockingCommands.layer.cornerRadius = 10
        InitialCommands.layer.cornerRadius = 10
        OutputCommand.layer.cornerRadius = 10
        SettingsButton.layer.cornerRadius = 5
        generateButton.layer.cornerRadius = 5

    }

    override func didReceiveMemoryWarning() {x
        super.didReceiveMemoryWarning()

    }

    @IBAction func popover(sender: AnyObject) {
        self.performSegueWithIdentifier("showView", sender: self)
    }


    @IBAction func Generate(sender: AnyObject) {

        OutputCommand.text = ""
        //stop the user from editing
        ClockingCommands.endEditing(true)
        InitialCommands.endEditing(true)

        //turn the command string into an array
        var ClockingCommandsArr = ClockingCommands.text.componentsSeparatedByString("\n")
        let InitialCommandsArr = InitialCommands.text.componentsSeparatedByString("\n")

        //get count of commands
        var commandsCount = 0
        var dummy = 0


        for commands in ClockingCommandsArr {
            if(commands.characters.first == "*") {
                ClockingCommandsArr.removeAtIndex(dummy)
                dummy = dummy - 1
            }
            dummy = dummy + 1
        }

        //print initial non-repeated output text
        func initial(){
            if(ClockingCommandsArr[0].characters.first != "*") {
         OutputCommand.text = "/summon FallingSand ~ ~1 ~ {Block:\"minecraft:redstone_block\",Time:1s,Passengers:[{id:\"FallingSand\",Block:\"minecraft:activator_rail\",Time:1s},{id:\"MinecartCommandBlock\",Command:\"fill ~" + String(commandsCount + 2) + " ~1 ~1 ~2 ~-1 ~-1 " + SecondBlock.text! + " hollow\"}" + ",{id:\"MinecartCommandBlock\",Command:\"fill ~" + String(commandsCount + 2) + " ~ ~1 ~2 ~ ~-1 " + FirstBlock.text! + " hollow\"},{id:\"MinecartCommandBlock\",Command:setblock ~3 ~ ~ repeating_command_block 5 replace {Command:" + ClockingCommandsArr[0] + ",auto:1b,TrackOutput:0b}}"
            }else{
                ClockingCommandsArr.removeFirst();
                initial()
            }
        }
        initial()
        ClockingCommandsArr.removeFirst()

        //write each command into the Output
        var labelText = "";
        for command in InitialCommandsArr {
            let nulledCommand = command.stringByReplacingOccurrencesOfString(" ", withString: "")
            if(nulledCommand.characters.count > 0 && nulledCommand.characters.first != "*"){

                labelText += ",{id:\"MinecartCommandBlock\",Command:\(command) }}"
            }
        }

        for command in ClockingCommandsArr {
            if(command.stringByReplacingOccurrencesOfString(" ", withString: "") != ""){
                if(command.characters.first != "*") {
            OutputCommand.text = OutputCommand.text + ",{id:\"MinecartCommandBlock\",Command:setblock ~" + String(dummy + 4) + " ~ ~ chain_command_block 5 replace {auto:1,TrackOutput0b,Command:" + command + "}}"
                }
            }
        }
        OutputCommand.hidden = false;

    }

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "showView"{
            let vc = segue.destinationViewController as UIViewController
            let controller = vc.popoverPresentationController
            if controller != nil{
                controller?.delegate = self
            }

        }

    }

    func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
        return .None
    }

}

我已经尝试 removing/refreshing 我的开发者资料。不工作。我 运行 它在同一台设备上的模拟器上运行,并且运行正常。我确保我的开发者资料在我的 phone 上得到验证,并且删除 phone 上的现有应用程序也不起作用。我还删除了 phone 上的开发人员配置文件并重置它,但它仍然崩溃。该应用程序放在我的 phone 上,当我打开它时,该应用程序冻结并且永远不会通过打开屏幕。这是否意味着我的 viewDidLoad() 函数可能有问题?我尝试更新 xcode 但没有可用的更新。我的 phone 是 运行ning iOS 9.2.1 而我的模拟器说 9.2 所以这可能是问题所在吗?我不记得上个月更新过我的 phone 所以我知道。

刚刚发现有关此设备日志的事情。这是输出的内容:

Incident Identifier: 0EB64729-68B2-4F5A-A20A-4CB29B36E12A
CrashReporter Key:   f6d773325288fbf35c24f7fd64cf50b66d87425b
Hardware Model:      iPhone7,2
Process:             CmdCombinerNew [206]
Path:                /private/var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/CmdCombinerNew
Identifier:          com.Matt.CmdCombinerNew
Version:             1 (1.0)
Code Type:           ARM-64 (Native)
Parent Process:      launchd [1]

Date/Time:           2016-02-26 10:46:33.33 -0600
Launch Time:         2016-02-26 10:46:33.33 -0600
OS Version:          iOS 9.2.1 (13D15)
Report Version:      105

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000120021088
Triggered by Thread:  0

Filtered syslog:
None found

Dyld Error Message:
Dyld Message: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/CmdCombinerNew
  Reason: no suitable image found.  Did find:
    /private/var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/Frameworks/libswiftCore.dylib: mmap() errno=1 validating first page of '/private/var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/Frameworks/libswiftCore.dylib'
  Dyld Version: 370.6

Binary Images:
0x1000e4000 - 0x1000f3fff CmdCombinerNew arm64   /var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/CmdCombinerNew
0x120020000 - 0x12004ffff dyld arm64   /usr/lib/dyld

希望所有这些信息对您有所帮助 :D。另外,这是重复的。我原来的 post 已经有一个星期没有 activity 了,所以我重新 post 编辑了它。请勿下架

为了解决这个问题,我发现将构建设置中的构建选项下的 "Embeded content cointains swift code" 设置为 yes 可以解决这个问题。