Giter VIP home page Giter VIP logo

Comments (18)

xuezhulian avatar xuezhulian commented on June 17, 2024 3

一个临时的解决方案 https://juejin.cn/post/7153606703399829511

from cocoaasyncsocket.

xiaoshaogg avatar xiaoshaogg commented on June 17, 2024

same error + 1

from cocoaasyncsocket.

LionWY avatar LionWY commented on June 17, 2024

same error + 1

from cocoaasyncsocket.

d6638219 avatar d6638219 commented on June 17, 2024

Is there a solution?

from cocoaasyncsocket.

herman602 avatar herman602 commented on June 17, 2024

same error + 1

from cocoaasyncsocket.

asim-aiondigital avatar asim-aiondigital commented on June 17, 2024

same error

from cocoaasyncsocket.

dustturtle avatar dustturtle commented on June 17, 2024

@xuezhulian 可以私聊下吗,请教一下细节,我的qq 123016764

from cocoaasyncsocket.

xuezhulian avatar xuezhulian commented on June 17, 2024

@dustturtle 有不懂的地方直接在掘金评论吧,老年人没有 qq 了

from cocoaasyncsocket.

github-actions avatar github-actions commented on June 17, 2024

This issue has been marked as stale, it will be closed automatically if there is no further activity.

from cocoaasyncsocket.

syhouse avatar syhouse commented on June 17, 2024

same error + 1

from cocoaasyncsocket.

silverhammermba avatar silverhammermba commented on June 17, 2024

Same error as well. I highly recommend reading the blog post above (use Google Translate if needed but the relevant code is at the bottom) #803 (comment)

tl;dr it's definitely a bug that Apple added to CoreFoundation in iOS 16. It is possible to hack around it by modifying your socket's struct to point at a custom release function. Personally I don't feel great about that so you can either hope that Apple fixes it or stop using stuff that relies on the old CFSocket type, like GCDAsyncSocket.

from cocoaasyncsocket.

xuezhulian avatar xuezhulian commented on June 17, 2024

@silverhammermba You are right, but It is very costly for us to deprecate GCDAsyncSocket.

from cocoaasyncsocket.

silverhammermba avatar silverhammermba commented on June 17, 2024

@xuezhulian I tried applying your fix but it did not resolve the crash for me. See PR #824. Could you take a look and see if there is some mistake in my implementation?

from cocoaasyncsocket.

zhuozhuo avatar zhuozhuo commented on June 17, 2024

same error + 1

from cocoaasyncsocket.

xuezhulian avatar xuezhulian commented on June 17, 2024

@silverhammermba 需要加到这个方法里面 closeWithError

from cocoaasyncsocket.

xuezhulian avatar xuezhulian commented on June 17, 2024
  • (void)closeWithError:(NSError *)error
    {
    LogTrace();
    NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue");

    [self endConnectTimeout];

    if (currentRead != nil) [self endCurrentRead];
    if (currentWrite != nil) [self endCurrentWrite];

    [readQueue removeAllObjects];
    [writeQueue removeAllObjects];

    [preBuffer reset];

    #if TARGET_OS_IPHONE
    {
    if (readStream || writeStream)
    {
    [self removeStreamsFromRunLoop];

      	if (readStream)
      	{
      		CFReadStreamSetClient(readStream, kCFStreamEventNone, NULL, NULL);
      		CFReadStreamClose(readStream);
      		CFRelease(readStream);
      		readStream = NULL;
      	}
          if (writeStream)
          {
              if (@available(iOS 16.0, *)) {
                  struct _ks_CFStream *cfstream  = (struct _ks_CFStream *)writeStream;
                  if (isMemoryReadable(cfstream, sizeof(*cfstream))
                     && isMemoryReadable(cfstream->info, sizeof(*(cfstream->info)))
                     && isMemoryReadable(cfstream->info->_socket, sizeof(*(cfstream->info->_socket)))
                     && isMemoryReadable(&(cfstream->info->_socket->_context), sizeof(cfstream->info->_socket->_context))
                     && isMemoryReadable(cfstream->info->_socket->_context.release, sizeof(*(cfstream->info->_socket->_context.release)))) {
                      if (cfstream->info != NULL && cfstream->info->_socket != NULL) {
                          if ((uintptr_t)cfstream->info->_socket->_context.release == (uintptr_t)CFRelease) {
                              origin_context_release = cfstream->info->_socket->_context.release;
                              cfstream->info->_socket->_context.release = new_context_release;
                          }
                      }
                  }
              }
    

from cocoaasyncsocket.

andyliuzs avatar andyliuzs commented on June 17, 2024

from cocoaasyncsocket.

Roman-Izaz avatar Roman-Izaz commented on June 17, 2024

After writing above mentioned piece of code it gives error like
"Call to undeclared function 'isMemoryReadable'; ISO C99 and later do not support implicit function declarations"
"Invalid application of 'sizeof' to an incomplete type 'struct __CFStream'"
"Incomplete definition of type 'struct __CFStream'"
@xuezhulian

from cocoaasyncsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.