当我尝试向NSMutableArray插入一个对象时,我收到一个'Program received signal:SIGABRT'错误,但是我不明白为什么.
这是我的代码,特别insertObject:value是导致错误的代码.
NSMutableDictionary *myDictionary = [NSMutableDictionary dictionary];
[myDictionary setValue:valueName.text forKey:kValueName];
[myDictionary setObject:subValuesList forKey:kSubValuesList];
MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
int position = appDelegate.position;
NSMutableArray *valuesList = [[NSUserDefaults standardUserDefaults] objectForKey:kValuesArray];
[valuesList insertObject:myDictionary atIndex:position];
Run Code Online (Sandbox Code Playgroud) 我正在开发一个iOS应用程序(http://affogato.visioa.com/),它实现了一个标签栏控制器,导航控制器和一个tableview控制器,每当我运行我的应用程序时,我得到:"线程1:程序接收信号: "SIGABRT".任何人都可以解释为什么我会得到这个以及如何纠正它?
以下是控制台:
2011-08-28 13:13:57.070 Affogato[16469:b303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "CoffeesView" nib but didn't get a UITableView.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc95a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f1d313 objc_exception_throw + 44
2 CoreFoundation 0x00d81ef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d81e6a +[NSException raise:format:] + 58
4 UIKit 0x00224e9b -[UITableViewController loadView] + 275
5 UIKit 0x000cb00e -[UIViewController view] + 56
6 UIKit 0x000c9482 -[UIViewController contentScrollView] + 42 …Run Code Online (Sandbox Code Playgroud) 我有一个UINavigationController,在屏幕上显示几个按钮.他们都只是使用这条线:
myViewController *newView = [[myViewController alloc] initWithNibName:@"myViewController"
bundle:nil];
[[self navigationController] pushViewController:newView animated:YES];
Run Code Online (Sandbox Code Playgroud)
转换到下一个视图.我有一个这样的视图控制器但是只会在iOS 5上导致此行崩溃.它在iOS 6上工作得非常好.我很困惑.崩溃没有真正的细节.这是一个强调main.m行的SIGABRT:
exitStatus = UIApplicationMain( argc, argv, nil, NSStringFromClass([ApplicationDelegate class]));
Run Code Online (Sandbox Code Playgroud)
我没有线索...
我是Xcode的新手.我正在使用Xcode 5.1.1.在OS X 10.9.2下.我想做一个非常简单的Mac应用程序,以了解如何在启动时在WebView中加载URL.在阅读了几个来源(包括来自StackOverflow的问题)之后,我尝试了大约10种不同的方法并完成了相同的结果 - 在Build&Run之后,屏幕上没有窗口.错误消息是:
在控制台区域:*由于未捕获的异常'NSInvalidUnarchiveOperationException'终止应用程序,原因:'* - [NSKeyedUnarchiver decodeObjectForKey:]:无法解码类的对象(WebView)'
libc ++ abi.dylib:以NSException类型的未捕获异常终止
我做了什么:
在IB中,我创建了WebView窗口并创建了一个插座zzz(我试图从AppDelegate按住Ctrl键拖动到WebView,反之亦然).所以这是我完成的代码:
// AppDelegate.h
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (retain, nonatomic) IBOutlet WebView *zzz;
@end
// AppDelegate.m
#import "AppDelegate.h"
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[self.zzz setMainFrameURL:@"http://www.google.com/"];
// I tried to put this code into awakeFromNib procedure too
}
@end
Run Code Online (Sandbox Code Playgroud)
我尝试使用applicationDidFinishLaunching/awakeFromNib中的代码,如下所示:
NSString *urlAddress = @"http://www.google.com/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest …Run Code Online (Sandbox Code Playgroud) 我尝试编写游戏代码(我在Swift中使用本教程https://www.youtube.com/watch?v=LkYpoRj-7hA im new).那是我的代码到目前为止:
import UIKit
class ViewController: UIViewController {
//Image View
@IBOutlet var ticTac_A01: UIImageView = nil
@IBOutlet var ticTac_A02: UIImageView = nil
@IBOutlet var ticTac_A03: UIImageView = nil
@IBOutlet var ticTac_B01: UIImageView = nil
@IBOutlet var ticTac_B02: UIImageView = nil
@IBOutlet var ticTac_B03: UIImageView = nil
@IBOutlet var ticTac_C01: UIImageView = nil
@IBOutlet var ticTac_C02: UIImageView = nil
@IBOutlet var ticTac_C03: UIImageView = nil
//Buttons
@IBOutlet var ticTacBtn_A01: UIButton = nil
@IBOutlet var ticTacBtn_A02: UIButton = nil
@IBOutlet …Run Code Online (Sandbox Code Playgroud) 我不是c ++程序员,但尝试调试一些复杂的代码.不是最好的先决条件,我知道......
所以我有一个openfoam求解器,它使用(包括)大量代码,我很难找到错误.我编译
SOURCE = mySolver.C; g ++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/software/openfoam/OpenFOAM-2.0.5/src/dynamicMesh/lnInclude {more linking} -I.-fPIC -c $ SOURCE -o Make/linux64Gcc46DPOpt/mySolver.o
并且在使用适当的选项运行求解器之后,它在我的return语句之后(或同时)崩溃:
BEFORE return 0
*** glibc detected *** /opt/software/openfoam/myLibs/applications/bin/linux64Gcc46DPOpt/mySolver: double free or corruption (!prev): 0x000000000d3b7c30 ***
======= Backtrace: =========
/lib64/libc.so.6[0x31c307230f]
/lib64/libc.so.6(cfree+0x4b)[0x31c307276b]
/opt/software/openfoam/ThirdParty-2.0.5/platforms/linux64/gcc-4.5.3/lib64/libstdc++.so.6(_ZNSsD1Ev+0x39)[0x2b34781ffff9]
/opt/software/openfoam/myLibs/applications/bin/linux64Gcc46DPOpt/mySolver(_ZN4Foam6stringD1Ev+0x18)[0x441e2e]
/opt/software/openfoam/myLibs/applications/bin/linux64Gcc46DPOpt/mySolver(_ZN4Foam4wordD2Ev+0x18)[0x442216]
/lib64/libc.so.6(__cxa_finalize+0x8e)[0x31c303368e]
/opt/software/openfoam/myLibs/lib/linux64Gcc46DPOpt/libTMP.so[0x2b347a17f866]
======= Memory map: ========
...
Run Code Online (Sandbox Code Playgroud)
我的求解器看起来像(抱歉,我不能发布所有部分):
#include "stuff1.H"
#include "stuff2.H"
int main(int argc, char *argv[])
{
#include "stuff3.H"
#include "stuffn.H"
while (runTime.run())
{
...
}
Info<< "BEFORE …Run Code Online (Sandbox Code Playgroud) 刚刚更新到Swift 3和xCode 8 Beta 4.
修复所有代码问题后,我现在有一个无错误的项目,但是当我点击我的前屏幕上的一个特定按钮时,它会抛出SIGABRT错误.
我确信它与目标页面上的UIPickerView元素有关,因为我已经删除,检查并重新添加了所有的segue和outlet以确保从那一方清楚一切.
控制台显示以下内容:
2016-08-02 18:59:46.607 ForceIt![38735:2895259] - [ForceIt_.DirectoryViewController numberOfComponentsInPickerView:]:无法识别的选择器发送到实例0x7fcd68c0c210 2016-08-02 18:59:46.618 ForceIt![38735:2895259]***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [ForceIt_.DirectoryViewController numberOfComponentsInPickerView:]:无法识别的选择器发送到实例0x7fcd68c0c210'
相关viewcontroller的代码如下:
import UIKit
var forceSelectedForTabView = String()
var forceSelectedPositionInArray = Int()
class DirectoryViewController: UIViewController, UIPickerViewDelegate {
@IBOutlet weak var forcePicker: UIPickerView!
@IBOutlet weak var selectedContactLabel: UILabel!
@IBOutlet weak var selectedPhoneTextView: UILabel!
@IBOutlet weak var selectedWebsiteTextView: UILabel!
//function for the number of columns in the picker
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
//function counting the array to …Run Code Online (Sandbox Code Playgroud) 我一直遇到带有消息的 SIGABRT 错误
"2017-04-20 17:37:54.872 SepsisHub[3670:1670129] Unknown class _TtC10Sepsis_Hub14ViewController in Interface Builder file.
2017-04-20 17:38:54.903 SepsisHub[3670:1670129] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fcb8ae03240> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key FirstHour.'"
Run Code Online (Sandbox Code Playgroud)
但是,我找不到故事板或 .swift 文件中缺少的连接。构建时没有错误消息,似乎由于某种原因程序找不到 IBOutlet,我不明白为什么考虑到我已将它们全部删除并在 swift 文件和情节提要连接器中多次重新连接而没有改变。
感谢您提供任何帮助。如果需要,将提供进一步的屏幕截图。
typedef struct{
void *val;
}struct_t;
void test(int val)
{
struct_t *s = malloc(sizeof(struct_t));
s->val = malloc(sizeof(int));
*(int*)&s->val = val;
free(s->val);
}
Run Code Online (Sandbox Code Playgroud)
free会产生一个sigabrt,但我认为这更像是我正在施放s-> val以使分配工作的方式的症状.执行此任务的正确方法是什么?
我在我的C程序中收到一个奇怪的SIGABRT,这是我出现问题的函数:
int get_interface_mac_addr(Interface* iface) {
char arquivo[10];
sprintf(arquivo, "/sys/class/net/%s/address", iface->interface_name);
int fd;
fd = open(arquivo, O_RDONLY, 0);
char buf[100];
read(fd, buf, sizeof (buf));
buf[strlen(buf) - 1] = '\0';
strcpy(iface->interface_mac_addr, buf);
close(fd);
return GET_MAC_ADDR_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
错误发生在最后一行代码"}".
我尝试使用GDB进行调试,但我是新手,所以我不理解GDB告诉我的很多事情.以下是GDB的输出:
Core was generated by `./vfirewall-monitor'.
Program terminated with signal 6, Aborted.
#0 0x00007f36c043b425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 0x00007f36c043b425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007f36c043eb8b in __GI_abort () at abort.c:91
#2 …Run Code Online (Sandbox Code Playgroud)