When I run my app on my device the app builds then crashes. I'm using swift 2, and I'm running it on an iPhone 6. It worked before but when I tried to add a save option it started crashing. I removed all references to the save option but it still crashes. I can run the app on a simulator but not on a device. As I said I could run it on my phone yesterday. Here is the error I get:
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)
Here is the code I use:
//
// 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
}
}
I have tried removing/refreshing my developer profile. Did not work. I ran it on a simulator on the same device and it worked. I made sure my developer profile is verified on my phone, and also deleting the existing app on the phone does not work. I have also deleted the developer profile on my phone and reset it and it still crashes. The app is put on my phone an when I open it the app freezes and never gets past the opening screen. Does this mean it could be something wrong with my viewDidLoad() function? I tried to update xcode but there is not an update available. My phone is running iOS 9.2.1 and my simulator says 9.2 so could this be the problem? I don't remember ever updating my phone in the last month so idk.
Just found out about this device logs thing. Here is what was outputted:
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
Hope all this info helps :D. Also, this is a duplicate. I got no activity on my original post for a week so I reposted it. Please do not take down
To fix this problem, I found that setting "Embeded content cointains swift code" under build options in build settings to yes fixes this.