【发布时间】:2016-03-04 16:35:06
【问题描述】:
当我在我的设备上运行我的应用程序时,应用程序构建然后崩溃。我正在使用 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,这可能是问题所在吗?我不记得在上个月更新过我的手机,所以 idk。
刚刚发现有关此设备日志的事情。这是输出的内容:
事件标识符:0EB64729-68B2-4F5A-A20A-4CB29B36E12A CrashReporter 密钥:f6d773325288fbf35c24f7fd64cf50b66d87425b 硬件型号:iPhone7,2 进程:CmdCombinerNew [206] 路径:/private/var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/CmdCombinerNew 标识符:com.Matt.CmdCombinerNew 版本:1 (1.0) 代码类型:ARM-64(本机) 父进程:launchd [1] 日期/时间:2016-02-26 10:46:33.33 -0600 发布时间:2016-02-26 10:46:33.33 -0600 操作系统版本:iOS 9.2.1 (13D15) 报告版本:105 异常类型:EXC_BREAKPOINT (SIGTRAP) 异常代码:0x0000000000000001、0x0000000120021088 由线程触发:0 过滤后的系统日志: 没有找到 Dyld 错误信息: Dyld 消息:库未加载:@rpath/libswiftCore.dylib 引用自:/var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/CmdCombinerNew 原因:没有找到合适的图片。发现: /private/var/mobile/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/Frameworks/libswiftCore.dylib: mmap() errno=1 验证'/private/var/mobile 的第一页/Containers/Bundle/Application/C2D5EB2C-21FB-4CA2-9F7E-1F12FA21B671/CmdCombinerNew.app/Frameworks/libswiftCore.dylib' 迪尔德版本:370.6 二进制图像: 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。此外,这是重复的。我的原始帖子一周没有任何活动,所以我重新发布了它。请不要删除
【问题讨论】:
-
如果您在 Google 中搜索“找不到合适的图像 libswiftcore.dylib”,它会为您提供一些可能原因的链接。有些与签名有关,有些与构建配置有关。