运行应用程序时崩溃。 Xcode 7 swift 2

时间:2016-02-25 16:46:11

标签: xcode swift swift2

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



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
    }

}




我尝试删除/刷新我的开发者个人资料。不工作。我在同一设备上的模拟器上运行它并且它工作。我确保在我的手机上验证了我的开发者个人资料,并且还删除了手机上的现有应用程序无效。我还删除了手机上的开发者个人资料并将其重置,但仍然崩溃。当我打开它时应用程序被放在我的手机上应用程序冻结并且永远不会超过打开的屏幕。这是否意味着我的viewDidLoad()函数可能有问题?我试图更新xcode,但没有可用的更新。我的手机正在运行iOS 9.2.1而我的模拟器说9.2这样可能会出现问题吗?我记得上个月没有更新我的手机了。

刚刚发现了这个设备日志的事情。这是输出的内容:



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  <816d2190e79537ccb5b08fd7e3190c6b> /var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/CmdCombinerNew
0x120020000 - 0x12004ffff dyld arm64  <9e98992ceed735e2ac4784cb28efe7c1> /usr/lib/dyld
&#13;
&#13;
&#13;

希望所有这些信息都有帮助:D。

0 个答案:

没有答案