Поток 1: сигнал SIGABRT - отлично работает в симуляторе
Я читал об этой ошибке, но я обнаружил, что это касается XIB и коннекторов.
Я посмотрел, но я не могу найти никаких проблем с моими разъемами... Однако я все еще получаю эту ошибку, когда я получаю эту строку кода:
NSMutableString pageData = [pacUtils requestErrorHistory:pac_ipAddr:pacPort];
Это вызывает функцию в классе "pacUtils". Я могу пройти через метод requestErrorHistory, и у него не будет никаких проблем, пока он не вернется к этой строке кода.
Кроме того, он отлично работает в симуляторе...
Это единственная ошибка в моем журнале, но она была там и в последнем выпуске (он работает нормально), потому что я не могу найти ссылку на этот файл png. Даже если я открою XIB в текстовом редакторе.
"2017-11-15 10: 51: 38.002688-0500 pachistory [5466: 2789765] Не удалось загрузить изображение"icon_pac-list-1.png", на которое ссылается перо в пакете с идентификатором" com.automationdirect.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; }
"RetrieveErrorHistory":
-(NSMutableString *)retrieveErrorHistory:(char *)ipToConn:(NSString *)port:(int)errHistSock:(BOOL)isEventHistory { struct sockaddr_in broadcastAddr; unsigned int broadcastPort = [pacPort intValue]; char recvString[1057]; socklen_t broadcastAddrLen = sizeof(broadcastAddr); int bytes_received; recvString[1056] = '\0'; // Put a null terminator on the end of the string... memset(&broadcastAddr, 0, sizeof(broadcastAddr)); broadcastAddr.sin_family = AF_INET; broadcastAddr.sin_addr.s_addr = inet_addr(ipToConn); broadcastAddr.sin_port = htons(broadcastPort); retrievedHistory = NO; // reset flag... [self startHistoryTimeoutMonitor]; if ((bytes_received = recvfrom(errHistSock, recvString, 1057, 0, (struct sockaddr *)&broadcastAddr, &broadcastAddrLen)) < 0) { NSLog(@"retrieveErrorHistory: recFrom Failed"); [self closeHistorySocket]; return nil; } retrievedHistory = YES; // got the history... BOOL wasHistory = NO; int rowBegin = 18; int COL1_BEGIN = 0; int COL1_LENGTH = 7; int COL2_BEGIN = 8; int COL2_LENGTH = 8; int COL3_BEGIN = 17; // The timestamp on the event history is not the same length... if (isEventHistory) { COL2_LENGTH = 5; COL3_BEGIN = 14; } for (int totalRows = 20; totalRows > 0; totalRows--) { NSString *row = [[NSString alloc] initWithFormat:@"%s", &recvString[rowBegin]]; NSString *trimmedRow = [row stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if ([trimmedRow length] >= 15) { // 15 character is the size of the date/time... it should be at least that long... [allHist appendString: @"<tr style=\"vertical-align: top;\">"]; [allHist appendString: @"<td style=\"border-left: Solid 1px #000000; border-right: Solid 1px #000000;font-size:34px;"]; [allHist appendString: @"border-bottom: Solid 1px #000000; width: 15%; padding-right: 10px;"]; [allHist appendString: @"padding-left: 10px; vertical-align: center;\"><p style=\"\""]; [allHist appendString: @"align=\"left\">"]; [allHist appendString: [trimmedRow substringWithRange: NSMakeRange (COL1_BEGIN, COL1_LENGTH)]]; [allHist appendString: @"</p></td>"]; [allHist appendString: @"<td style=\"border-left: Solid 1px #000000; border-right: Solid 1px #000000;font-size:34px;"]; [allHist appendString: @"border-bottom: Solid 1px #000000; width: 15%; padding-right: 10px;"]; [allHist appendString: @"padding-left: 10px; vertical-align: center;\"><p style=\"\""]; [allHist appendString: @"align=\"left\">"]; [allHist appendString: [trimmedRow substringWithRange: NSMakeRange (COL2_BEGIN, COL2_LENGTH)]]; [allHist appendString: @"</p></td>"]; [allHist appendString: @"<td style=\"border-left: Solid 1px #000000; border-right: Solid 1px #000000;font-size:34px;"]; [allHist appendString: @"border-bottom: Solid 1px #000000; width: 40%; padding-right: 10px;"]; [allHist appendString: @"padding-left: 10px; vertical-align: center;\"><p style=\"\""]; [allHist appendString: @"align=\"left\">"]; [allHist appendString: [trimmedRow substringFromIndex: COL3_BEGIN]]; [allHist appendString: @"</p></td></tr>"]; wasHistory = YES; rowBegin = rowBegin + 52; // 52 is the spacing between each row in the message } else { break; } [row release]; //[trimmedRow release]; //Crashes when I release it....?? } if (!wasHistory) { [allHist appendString: @"<tr style=\"vertical-align: top;\">"]; [allHist appendString: @"<td colspan=\"3\" style=\"border-left: Solid 1px #000000; border-right: Solid 1px #000000;font-size:34px;"]; [allHist appendString: @"border-bottom: Solid 1px #000000; width: 15%; padding-right: 10px;"]; [allHist appendString: @"padding-left: 10px; vertical-align: center;\"><p style=\"\""]; [allHist appendString: @"align=\"left\">"]; [allHist appendString: @"No History to Display\n"]; [allHist appendString: @"</p></td></tr>"]; } [allHist appendString: @"</table>"]; [allHist appendString: @"<p> </p>"]; return allHist; }