线程1:信号SIGABRT - 在模拟器中运行良好

时间:2017-11-15 16:15:09

标签: ios sigabrt

我已经读过这个错误,但我发现的是与XIB和连接器有关。

我看过了,但是我找不到连接器的任何问题......但是当我到达这行代码时,我仍然会收到此错误:

NSMutableString pageData = [pacUtils requestErrorHistory:pac_ipAddr:pacPort];

这是在类“pacUtils”中调用一个函数。我可以单步执行方法“requestErrorHistory”,它返回到这行代码之前没有任何问题。

此外,它在模拟器中运行良好......

这是我的日志中唯一的错误,但它也是最后一个版本(运行正常)因为我实际上找不到对此png文件的任何引用。即使我在文本编辑器中打开XIB。

“2017-11-15 10:51:38.002688-0500 pachistory [5466:2789765]无法加载带有标识符”com.automationdirect“的包中nib引用的”icon_pac-list-1.png“图像。 pachistory “”

我在Xcode 9.1下运行。

非常感谢任何帮助。

“requestErrorHistory”:

-(NSMutableString *) requestErrorHistory:(char *)ipToConn:(NSString *)port {
// Make sure we have a good network...
if ( ![self checkNetwork] ) {
    return nil;
}


char eventBuffer[175], critBuffer[175], noncritBuffer[175];
struct sockaddr_in PhoneAddr, BorgAddr;

if (allHist == nil) {
    allHist = [NSMutableString stringWithString: @""];
}

//Event history
eventBuffer[0] = 0x00;
... finish defining message...

//Critical errors
critBuffer[0] = 0x00;
... finish defining message...

// Non-critical errors
noncritBuffer[0] = 0x00;
... finish defining message...

/* create a socket for sending to the pac address */
if ((errHistSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { 
    NSLog(@"ERROR: requestErrorHistory - socket() failed"); 
    return nil; 
}  

memset(&PhoneAddr, 0, sizeof(PhoneAddr)); 
NSString *phoneIP = [self getIPAddress];

const char *charIp = [phoneIP UTF8String];
PhoneAddr.sin_family = AF_INET;
PhoneAddr.sin_addr.s_addr =inet_addr(charIp);

if (bind(errHistSock, (struct sockaddr *) &PhoneAddr, sizeof(struct sockaddr_in)) < 0) { 
    NSLog(@"ERROR HIST: bind not successful"); 
    return nil; 
} 

/* construct a pac address structure - erase everything in the structure first*/ 
    memset(&BorgAddr, 0, sizeof(BorgAddr)); 

BorgAddr.sin_family = AF_INET;
BorgAddr.sin_addr.s_addr = inet_addr(ipToConn);
BorgAddr.sin_port = htons([pacPort intValue]);

/* send string to pac address */ 
if ((sendto(errHistSock, eventBuffer, sizeof(eventBuffer), 0, (struct sockaddr *) &BorgAddr, sizeof(BorgAddr))) != sizeof(eventBuffer)) { 
    NSLog(@"ERROR EVENT: requestErrorHistory - sendto() sent incorrect number of bytes"); 
    return nil; 
} 

[self buildHTMLHeader:@"Event History"];

[self retrieveErrorHistory:ipToConn:port:errHistSock:YES]; // First process the event history

/* send string to pac address */ 
if ((sendto(errHistSock, critBuffer, sizeof(critBuffer), 0, (struct sockaddr *) &BorgAddr, sizeof(BorgAddr))) != sizeof(critBuffer)) { 
    NSLog(@"ERROR NON-CRIT: requestErrorHistory - sendto() sent incorrect number of bytes"); 
    return nil; 
} 

[self buildHTMLHeader:@"Error History - Critical"];

[self retrieveErrorHistory:ipToConn:port:errHistSock:NO]; // First process the critical error history

[self buildHTMLHeader:@"Error History - Non-Critical"]; 

/* send string to multicast address */ 
if ((sendto(errHistSock, noncritBuffer, sizeof(noncritBuffer), 0,     (struct sockaddr *) &BorgAddr, sizeof(BorgAddr))) != sizeof(noncritBuffer))       { 
    NSLog(@"ERROR CRIT: requestErrorHistory - sendto() sent incorrect number of bytes"); 
    return nil; 
} 

[self retrieveErrorHistory:ipToConn:port:errHistSock:NO]; // First process the non-critical error history
[allHist appendString: @"</div>"];

close(errHistSock);
return allHist;
}

-(NSMutableString *) requestErrorHistory:(char *)ipToConn:(NSString *)port { // Make sure we have a good network... if ( ![self checkNetwork] ) { return nil; } char eventBuffer[175], critBuffer[175], noncritBuffer[175]; struct sockaddr_in PhoneAddr, BorgAddr; if (allHist == nil) { allHist = [NSMutableString stringWithString: @""]; } //Event history eventBuffer[0] = 0x00; ... finish defining message... //Critical errors critBuffer[0] = 0x00; ... finish defining message... // Non-critical errors noncritBuffer[0] = 0x00; ... finish defining message... /* create a socket for sending to the pac address */ if ((errHistSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { NSLog(@"ERROR: requestErrorHistory - socket() failed"); return nil; } memset(&PhoneAddr, 0, sizeof(PhoneAddr)); NSString *phoneIP = [self getIPAddress]; const char *charIp = [phoneIP UTF8String]; PhoneAddr.sin_family = AF_INET; PhoneAddr.sin_addr.s_addr =inet_addr(charIp); if (bind(errHistSock, (struct sockaddr *) &PhoneAddr, sizeof(struct sockaddr_in)) < 0) { NSLog(@"ERROR HIST: bind not successful"); return nil; } /* construct a pac address structure - erase everything in the structure first*/ memset(&BorgAddr, 0, sizeof(BorgAddr)); BorgAddr.sin_family = AF_INET; BorgAddr.sin_addr.s_addr = inet_addr(ipToConn); BorgAddr.sin_port = htons([pacPort intValue]); /* send string to pac address */ if ((sendto(errHistSock, eventBuffer, sizeof(eventBuffer), 0, (struct sockaddr *) &BorgAddr, sizeof(BorgAddr))) != sizeof(eventBuffer)) { NSLog(@"ERROR EVENT: requestErrorHistory - sendto() sent incorrect number of bytes"); return nil; } [self buildHTMLHeader:@"Event History"]; [self retrieveErrorHistory:ipToConn:port:errHistSock:YES]; // First process the event history /* send string to pac address */ if ((sendto(errHistSock, critBuffer, sizeof(critBuffer), 0, (struct sockaddr *) &BorgAddr, sizeof(BorgAddr))) != sizeof(critBuffer)) { NSLog(@"ERROR NON-CRIT: requestErrorHistory - sendto() sent incorrect number of bytes"); return nil; } [self buildHTMLHeader:@"Error History - Critical"]; [self retrieveErrorHistory:ipToConn:port:errHistSock:NO]; // First process the critical error history [self buildHTMLHeader:@"Error History - Non-Critical"]; /* send string to multicast address */ if ((sendto(errHistSock, noncritBuffer, sizeof(noncritBuffer), 0, (struct sockaddr *) &BorgAddr, sizeof(BorgAddr))) != sizeof(noncritBuffer)) { NSLog(@"ERROR CRIT: requestErrorHistory - sendto() sent incorrect number of bytes"); return nil; } [self retrieveErrorHistory:ipToConn:port:errHistSock:NO]; // First process the non-critical error history [allHist appendString: @"</div>"]; close(errHistSock); return allHist; }

“retrieveErrorHistory”:

0 个答案:

没有答案