Thread 1 signal sigterm ошибка

My swift application is set for certain IOS device, and runs fine in IOS simulator,

However, when changing hardware in IOS simulator, I get the error in swift Thread1: signal SIGTERM.

I can set swift for IOS device iPhone 6, IOS simulator runs iPhone 6, but can’t change to other hardware (such as iPhone 4S).
I can set swift for IOS device iPhone 4S, and IOS simulator runs fine for iPhone 4S, but get the error when changing hardware (such as iPhone 6 which worked fine before).

Therefore, I am pretty sure the swift application logic is correct.

How can I solve this?

Hello!

I am using macOS Catalina, Xcode 11. I just started working on app development and this is my first project. Every time i try to simulate the code the program crashes and it gives me thread 1 signal SIGTERM error. My code is very simple, I don’t think i have an error there. I am really stuck, I tried to run different projects but it doesn’t work on any of them. Please, can someone help me fix this error?

Thanks in advance!

Replies

I have the same error, you have the solution? Thank you

I have a similar problem … create a game for iOS; build and run it; click the Red window close button and the app crashes with a SIGTERM error in class AppDelegate: UIResponder, UIApplicationDelegate.

I have added no code.

Same thing happens for a Single View App.

Xcode 11.5 on Catalina 10.15.5

Hi!

I think I found what the issue was. So I read carefully the error message, and in my case it gave me 3 following errors: SKView warning logs, Metal API was enabled, and Metal GPU Frame Capture was enabled. As I found SKView error is SpriteKit’s mistake that should disappear in new versions of XCode. The rest two errors I just disabled them in the Xcode Scheme:
» Product>Scheme>Edit Scheme>Options> Metal API Validation/ Metal GPU Frame Capture > disable «. Now I have only SKView error message hope it will be gone when I install XCode 12.

I hope it was helpful!

Hi,
i know its a bit late but for people, who are getting the same Error.
You are closing the simulator wrong, u have to use cmd and q.
hope that solved your Problem :)

Use the stop the running scheme or application button, rather than quitting the simulator this does not seem to cause the error

Hi all! I am getting this error while trying to run a calculator code on last Xcode 13.0. Did not have that problem in previous versions. App runs well until I close the Simulator and the error gets triggered. this is what is shown on left panel. Thread 3 Queue : com.apple.UIKit.KeyboardManagement (serial).

This is what I am getting at the debugger:

dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/osuhe/Library/Developer/Xcode/DerivedData/Calculator_Layout_iOS13-cdskmxpuiszizdgxwiezanhkuedj/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/osuhe/Library/Developer/Xcode/DerivedData/Calculator_Layout_iOS13-cdskmxpuiszizdgxwiezanhkuedj/Build/Products/Debug-iphonesimulator

CoreSimulator 776.3 — Device: iPhone 8 Plus (53744E1C-0ED4-4759-9FFA-1B0D0DFEF30C) — Runtime: iOS 15.0 (19A339) — DeviceType: iPhone 8 Plus

(lldb) 

Мое быстрое приложение настроено для определенного устройства IOS и отлично работает в симуляторе IOS,

Однако при смене аппаратного обеспечения в симуляторе IOS я получаю ошибку в быстром потоке Thread1: сигнал SIGTERM.

Я могу быстро установить устройство IOS iPhone 6, симулятор IOS запускает iPhone 6, но не может перейти на другое оборудование (например, iPhone 4S). Я могу быстро установить устройство IOS для iPhone 4S, а симулятор IOS отлично работает для iPhone 4S, но получаю ошибку при смене аппаратного обеспечения (например, iPhone 6, который работал хорошо раньше).

Поэтому я уверен, что быстрая логика приложения правильная.

Как я могу это решить?

Вопрос:

Мое быстрое приложение настроено для определенного устройства IOS и отлично работает в симуляторе IOS,

Однако при смене аппаратного обеспечения в симуляторе IOS я получаю ошибку в быстром потоке Thread1: сигнал SIGTERM.

Я могу быстро установить устройство IOS iPhone 6, симулятор IOS запускает iPhone 6, но не может перейти на другое оборудование (например, iPhone 4S). Я могу быстро установить устройство IOS для iPhone 4S, а симулятор IOS отлично работает для iPhone 4S, но получаю ошибку при смене аппаратного обеспечения (например, iPhone 6, который работал хорошо раньше).

Поэтому я уверен, что быстрая логика приложения правильная.

Как я могу это решить?

Лучший ответ:

Это ожидаемое поведение. Ничего не нужно “решать”. Ваше приложение правильно отправлено SIGTERM, потому что вы попросили выключить запущенное устройство и загрузить новый (который завершит все запущенные процессы на существующем устройстве).

Back to blog


Aasif Khan

By  | Last Updated on April 10th, 2023 8:30 am | 4-min read

One minute your iOS app runs fine in Xcode, and the next it has hopelessly crashed with a cryptic SIGABRT error. What’s going on!?

In this app development tutorial you’ll learn:

  • How to solve the “Signal SIGABRT” error in Xcode
  • How to use some of the debugging tools in Xcode
  • What SIGABRT stands for, and what its causes are
  • 3 approaches to find the root cause of SIGABRT

The error SIGABRT stands for “signal abort”. It’s a signal that’s sent by iOS – the operating system – to a running app, which will immediately quit the app because of a runtime error. It essentially means your app has crashed…

In the screenshot you see a few things:

  • On the left you see a list of threads that ran when the app crashed. You see that the thread that caused the crash is the main thread, or “Thread 1”.
  • In the editor we see that dreaded Thread 1: signal SIGABRT error. It has highlighted line 12 in the editor, the class definition of AppDelegate.
  • At the bottom you see helpful debug output. In this case, you get a stacktrace and a cryptic error message about not being “key value coding-compliant.”

The problem with the SIGABRT error is that it’s too generic. Xcode is basically saying: “Look, your app has crashed, that’s all we know.” In most cases of the SIGABRT error, you get little information about what’s caused the error.

Before we go on, let’s discuss a few misconceptions and common pitfalls of SIGABRT:

  • The SIGABRT error usually has nothing to do with the AppDelegate class declaration, even though it highlights that line in Xcode. The line is highlighted because it’s the first line of code of your app. Don’t waste your time looking in the AppDelegate class, unless you’re absolutely certain the bug is in there.
  • The stacktrace is a list of function calls that lead up to the app crashing. That doesn’t mean the line of code that caused the error is anywhere in the stacktrace. It sometimes is, but in other cases, the stacktrace merely leads to the code that choked on a value you set elsewhere in your own code.
  • Don’t stare yourself blind on a SIGABRT error. There’s a rational, logical cause for the error. It’s probably a bug in your own code, and there’s nothing wrong with that. Apps aren’t magic, no one is out to get you, and bugs never appear out of the blue. Don’t frustrate yourself with thoughts like “It ran fine yesterday!” – it always does, and now it doesn’t!

Now that we’ve established a baseline, let’s get to the first cause of SIGABRT.

A common cause of “Signal SIGABRT” is a typo or bug in your outlets. Here’s what happened:

  • You created a new view controller in Interface Builder, and set it up with a few UI elements like buttons and labels
  • You connected these UI elements to your code by using outlet properties, which creates a connection between a property of your view controller and the UI element in Interface Builder
  • At one point you changed the name of the initial outlet property and your app started crashing with a SIGABRT error

When you’re using Interface Builder to create a view controller, your app will use the XIB file to generate the view controller’s UI when your app runs (roughly speaking). At this point it will also connect outlets from the XIB to properties of the view controller class.

If you’ve changed the name of an outlet property, your app can’t find it anymore. And because of that it will throw an exception. What’s causing the SIGABRT error, is not handling that exception.

Here’s what that looks like in Xcode:

See what’s happening? The property is called otherButton, but the outlet is still called button. At one point we changed the outlet – because the new name is better – and confused the app, which made it crash.

At the top of the stacktrace we also spot another clue:

Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<…> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key button.
What does that mean? The app is telling us at this point that the view controller is not key value coding compliant for the key button. This means that it cannot find the button property on the view controller. And that’s true, because we’ve renamed it.

iOS uses a mechanism called key value coding to inspect the properties a view controller has, so it can use those properties to reference UI elements it has created based on the XIB.

How do you solve the bug at this point? You can use 2 approaches:

  1. You rename the property back to its original name
  2. You remove the outlet connection in Interface Builder, and reconnect it using the new outlet property name

Quick Tip: Just as a changed @IBOutlet can cause “Thread 1: signal SIGABRT”, so can erroneously changing the name of an action, i.e. with @IBAction, cause the SIGABRT error.

In many cases Xcode won’t show you any helpful error messages for a SIGABRT crash. When that happens, it’s useful to know a few debugging commands, such as bt.

Xcode has an integrated debugging environment called LLDB. It’s what you see at the bottom of Xcode when your app runs, the Console or debug output area. You often see debug messages here, but did you know you can also use it to input commands?

Next time your app crashes, try typing help in LLDB. Like this:

You’ll see that many of the LLDB commands directly correspond to actions you can take with the debugger, such as setting breakpoints, stepping over lines of code, and inspecting runtime values.

One command is particularly useful. You can type in bt to see the current call stack (also called “backtrace” or “stacktrace”). This is a list of all functions that ran up to the current crash. This trace typically includes the function that caused a bug.

Here, check out the stacktrace of a typical Index out of range error. In the screenshot below, we’ve deliberately caused that error by getting index 99 from an array that only has 4 items. When the app crashes, bt can tell us which line of code caused the error.

Can you spot the following information in the stacktrace?

  • The offending code is at line 21 of ViewController.swift, inside the viewDidLoad() function
  • You can even see that we used the subscript “getter” of Array
  • Before the crash a whole bunch of view controller-related function calls were made

Based on the information we got with bt, we can find the offending line in our code and fix it. Xcode already helped us in this case, by highlighting the error in the editor. In some scenarios you won’t have such luck, and then it can be helpful to use the bt command.

One last thing: you can inspect values at runtime with the print command. In the above scenario, typing print names would have produced this output:

([String]) $R0 = 4 values {
[0] = “Ford”
[1] = “Arthur”
[2] = “Zaphod”
[3] = “Trillian”
}

For printing complex objects, use po. Awesome!

Keep in mind that a stacktrace runs outside-in. The bottom of the stack trace shows top-level function calls, and the higher up the stack you go, the deeper the calls go in. The latest, most recent, deepest-level call is at the top of the stack.

An exception breakpoint is triggered whenever an exception occurs in your code. Instead of specifying on which line the breakpoint is triggered, you instruct the debugger to halt code execution for exceptions.

Exception breakpoints are useful for inspecting the code when an exception occurs. You can see which line of code threw the exception, and you can inspect values in your code at that point. Some exceptions are caused by bugs or invalid states of your app, so exception breakpoints are useful for finding and fixing those bugs.

Here’s how you can set an exception breakpoint:

  1. Go to the Breakpoint navigator in Xcode, by using the tabs on the left
  2. Click on the bottom-left +-button and choose Exception Breakpoint
  3. Leave the default settings as-is (although they’re helpful to customize)
  4. Run your code

When an exception is thrown, execution of your app halts. You can now use the debugger to inspect values, step through the code, and use LLDB commands. When possible, Xcode will take you to the line of code that caused the exception.

Keep in mind that an exception doesn’t necessarily crash your app! So, whenever the exception breakpoint is enabled, and an exception occurs, your app is halted. Halting code with a breakpoint isn’t the same as an app crash, so don’t let that confuse you.

For example, an exception breakpoint will get triggered by an Unsatisfied constraints exception, but that won’t crash your app. Use the exception breakpoint to gather extra information for the SIGABRT crash, and then disable it once you’ve solved the bug (until it’s needed again).

The SIGABRT error is quite cryptic, and can prove difficult to solve. Why can’t Xcode just give helpful error messages? Well, that’s a good question…

The short answer is that there are so many moving parts in iOS development that Xcode can’t always determine the cause of a crash. Xcode doesn’t know that you erroneously changed the name of an outlet. It only knows that in connecting the outlet, some code was invoked, and that caused an exception.

This means you’ll always see an error that’s as close to the root cause as possible. The best you can do is make lots of mistakes, decrypt lots of error messages, and get to know them better. And what you’ve learned in this tutorial, is how to find and solve the SIGABRT error!

Create Your App Now

Related Articles

  • 9 Tips to Stay Productive When Working from Home in Quarantine
  • 10 Best Business Magazines for Entrepreneurs
  • Top 7 ShipStation Integrations for Better Management
  • Here’s How to Tighten Your App Marketing Strategy (4 Mistakes to Avoid)
  • What is Brand Logo and How to Create a Logo for Your brand?
  • How Much Does it Cost to Make an App?
  • 7 Intercom Integrations You Should Use
  • Origin, History & Design Power of Neon Colors
  • Top 7 Augmented Reality Apps for Android & iOS
  • How Integrating These 4 Appy Pie Features Can Increase the Value of Your Business

App Builder

mardi 5 mai 2015

(XCode) Error signal SIGTERM everytime I quit the iOS simulator

Everytime I quit the iOS Simulator using XCode the error «Thread 1: signal SIGTERM» shows up in the AppDelegate.swift file, right in the «class AppDelegate:___{» line. The only thing that shows up in the console is «(llbd)».


Publié par

Informatique




à

17:53






Libellés :
Active questions tagged ios — Stack Overflow

Aucun commentaire:

Enregistrer un commentaire


Article plus récent


Article plus ancien

Accueil

Inscription à :
Publier les commentaires (Atom)

Начал делать впервые приложение по гайду, компилирую его, тестирую — вылезает ошибка

class AppDelegate: UIResponder, UIApplicationDelegate {

«Thread 1: signal SIGABRT» и приложение даже не открывается (что в общем то не странно).
Приложение для расчета индекса массы тела. Окна задал, связь с ними задал.

//
//  FirstViewController.swift
//  Mass App
//
//  Created by *** on 30.08.16.
//  Copyright © 2016 ***. All rights reserved.
//

import UIKit

class FirstViewController: UIViewController {
    
    
    
    @IBOutlet weak var ageTextField: UITextField!
    @IBOutlet weak var heightTextField: UITextField!
    @IBOutlet weak var weightTextField: UITextField!
    @IBOutlet weak var sexSegmentedControl: UISegmentedControl!
    @IBOutlet weak var activitySegmentedControl: UISegmentedControl!
    @IBOutlet weak var resultsLabel: UILabel!
    @IBAction func calculateTapped(sender: AnyObject)
    {
        weak var activitySegmentedControl: UISegmentedControl!
        func calculateTapped(sender: AnyObject) {
            var bmr: Double = 0
            var bmi: Double = 0
            
            if let age = Int(ageTextField.text!) {
                if let height = Int(heightTextField.text!) {
                    if let weight = Int(weightTextField.text!) {
                        switch sexSegmentedControl.selectedSegmentIndex {
                        case 0:
                            bmr = 88.362 + 13.397 * Double(weight) + 4.799 * Double(height) - 5.677 * Double(age)
                        case 1:
                            bmr = 447.593 + 9.247 * Double(weight) + 3.098 * Double(height) - 4.330 * Double(age)
                        default:
                            bmr = 0
                        }
                        bmi = Double(weight) / pow(Double(height) / 100, 2)
                    }
                }
            }
            
            let factor = [1.375, 1.55, 1.725, 1.9]
            let selectedFactor = factor[activitySegmentedControl.selectedSegmentIndex]
            bmr *= selectedFactor
            resultsLabel.text? = "Вы должны потреблять (Int(bmr)) килокалорий для поддержания веса.nИндекс массы тела (Int(bmi))."
            
            UIApplication.sharedApplication().keyWindow!.endEditing(true)
            
        }
        
    }
    
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
}

Ошибка:

2016-08-30 19:05:45.409 Mass App[4618:118258] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Mass_App.FirstViewController 0x7c88dbc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key activityTextField.'

Предполагаю что ошибка в том что я до этого вместо activitySegmentedControl писал activityTextField.
Где то это осталось и не дает запуску? Или что?..

Понравилась статья? Поделить с друзьями:
  • This program cannot be run on ошибка
  • This product is covered one or more ошибка
  • This presents are for mum где ошибка
  • This page contains the following errors ошибка
  • This page cannot be displayed ошибка