线程1:信号SIGABRT + libc ++ abi.dylib:以类型为NSException(lldb)的未捕获异常终止

时间:2019-03-22 06:31:26

标签: swift xcode sigabrt nsexception

我刚刚开始编码,想知道如何克服这个问题。

在AppDelegate.swift文件中

    [HttpPost]
    public ActionResult Validate([FromBody] UserLogin user)
    {
        var login = _context.UserLogin.Where(s => s.username == user.password);
        ...        
    }

GameScene文件

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    return true
}

func applicationWillResignActive(_ application: UIApplication) {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

在控制台中

import SpriteKit
import GameplayKit

class GameScene: SKScene {

let player = SKSpriteNode(imageNamed: "rocket_launcher")
let enemy = SKSpriteNode(imageNamed: "attack_shuttle")

let gameArea: CGRect


override init(size: CGSize) {
    let maxAspectRatio: CGFloat = 16.0/9.0
    let playableWidth = size.height/maxAspectRatio
    let margin = (size.width-playableWidth)/2
    gameArea = CGRect(x: margin, y: 0, width: playableWidth, height: size.height)
    super.init(size: size)
}
required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}


func random() -> CGFloat {
    return CGFloat(Float(arc4random()) / 0xffffffff)
}
func random(min min: CGFloat, max: CGFloat) -> CGFloat{
    return random() * (max - min) + min
}




override func didMove(to view: SKView) {
    let background = SKSpriteNode(imageNamed: "background")
    background.size = self.size
    background.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
    background.zPosition = 0
    self.addChild(background)

    let foreground =  SKSpriteNode(imageNamed: "ufo_Background")
    foreground.size = gameArea.size
    foreground.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
    foreground.zPosition = 10
    self.addChild(foreground)


    player.setScale(1)
    player.position = CGPoint(x: self.size.width/2, y: self.size.height*0.10)
    player.zPosition = 2
    self.addChild(player)

    startNewLevel()
}



func startNewLevel(){
    let spawn = SKAction.run(spawnEnemy)
    let waitToSpawn = SKAction.wait(forDuration: 1)
    let spawnSequence = SKAction.sequence([waitToSpawn,spawn])
    let spawnForever = SKAction.repeatForever(spawnSequence)
    self.run(spawnForever)
}



func fireBullet(){

    let bullet = SKSpriteNode(imageNamed: "Starship_Rocket")
    bullet.setScale(1)
    bullet.position = player.position
    bullet.zPosition = 1
    self.addChild(bullet)

(lldb)

我不知道该如何克服这个问题。 我所有的店铺都在工作。其他页面均无济于事。 如果有人知道如何解决此问题,请告诉我。 谢谢

0 个答案:

没有答案