我正在开发一个 Swift 应用程序。我正在使用套接字进行后台连接。但是当我尝试使用它时,我知道我收到了这个错误:
libsystem_kernel.dylib`__pthread_kill:
0x11329edd0 <+0>: movl $0x2000148, %eax ; imm = 0x2000148
0x11329edd5 <+5>: movq %rcx, %r10
0x11329edd8 <+8>: syscall -> 0x11329edda <+10>: jae 0x11329ede4 ; <+20>
0x11329eddc <+12>: movq %rax, %rdi
0x11329eddf <+15>: jmp 0x113297d6f ; cerror_nocancel
0x11329ede4 <+20>: retq
0x11329ede5 <+21>: nop
0x11329ede6 <+22>: nop
0x11329ede7 <+23>: nop
它还显示“线程:信号 Sigabrt”
.这里我调用方法:
let x:ComObwareAlifstoPostConnection = ComObwareAlifstoPostConnection()
DispatchQueue.global(qos: .background).async {
x.connect()
let y = x.getPostsWith("username", with: "password", with: "15000000000000", with: "down", with: "0")
DispatchQueue.main.async {
}
}
这是我的 Objective-C 类(它是由 J2Objc 转换的 Java)
- (IOSObjectArray *)getPostsWithNSString:(NSString *)username
withNSString:(NSString *)password
withNSString:(NSString *)time
withNSString:(NSString *)direction
withNSString:(NSString *)minTime {
IOSObjectArray *returnArray = nil;
@try {
[self connect];
if (ComObwareAlifstoPostConnection_socket == nil) {
return nil;
}
JavaIoDataOutputStream *os = new_JavaIoDataOutputStream_initWithJavaIoOutputStream_([ComObwareAlifstoPostConnection_socket getOutputStream]);
[os writeUTFWithNSString:JreStrcat("C$$$$$$$$$$", '2', ComObwareAlifstoPostConnection_SPLITTED, username, ComObwareAlifstoPostConnection_SPLITTED, password, ComObwareAlifstoPostConnection_SPLITTED, time, ComObwareAlifstoPostConnection_SPLITTED, direction, ComObwareAlifstoPostConnection_SPLITTED, minTime)];
[os flush];
JavaIoObjectInputStream *in = new_JavaIoObjectInputStream_initWithJavaIoInputStream_([((JavaNetSocket *) nil_chk(ComObwareAlifstoPostConnection_socket)) getInputStream]);
while ((returnArray = (IOSObjectArray *) cast_check([in readObject], IOSClass_arrayType(ComObwareAlifstoPostPost_class_(), 1))) != nil) {
return returnArray;
}
}
@catch (JavaNetUnknownHostException *e) {
}
@catch (JavaIoIOException *e) {
if (!hastried_) {
hastried_ = true;
return [self getPostsWithNSString:username withNSString:password withNSString:time withNSString:direction withNSString:minTime];
}
[((JavaIoIOException *) nil_chk(e)) printStackTrace];
}
@catch (JavaLangClassNotFoundException *e) {
}
return nil;
}
那么,错误可能在哪里?使用其他一些方法它可以工作。