-1

私は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    

また、「スレッド: Signal 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;
}

では、どこにエラーがあるのでしょうか? 他の方法ではうまくいきます。

4

1 に答える 1