React-native: [RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x28048f800

Created on 10 Dec 2019  ·  28Comments  ·  Source: facebook/react-native

small probability of the following error:

-[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x28048f800
NSInvalidArgumentException

React Native version:0.61

Bug

Most helpful comment

I am seeing this as well from my bugsnag, but could not get my head around where the issue stems from.

NSException object:

address
0
nsexception
{
  "name": "NSInvalidArgumentException",
  "referenced_object": {
    "ivars": {
      "_target": {
        "ivars": {
          "_currentTime": 0.00365243,
          "_currentFrame": {
            "address": 10771867776,
            "type": "objc_object",
            "class": "UIImage"
          },
          "_currentFrameIndex": 76,
          "_bufferMiss": false,
          "_totalLoopCount": 0,
          "_totalFrameCount": 209,
          "_currentLoopCount": 0,
          "_maxBufferSize": 0,
          "_animatedImage": {
            "address": 10777021184,
            "type": "objc_object",
            "class": "RCTAnimatedImage"
          },
          "_frameBuffer": {
            "address": 10756376800,
            "type": "objc_object",
            "class": "__NSDictionaryM"
          }
        },
        "type": "objc_object",
        "class": "RCTUIImageViewAnimated",
        "address": 4713924304
      }
    },
    "type": "objc_object",
    "class": "RCTWeakProxy",
    "address": 10754999872
  }
}
reason
-[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x2810c4640
type
nsexception

What would this exactly mean? Something to do with RCTUIImageViewAnimated?

Stack Trace:

NSInvalidArgumentException -[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x2810c4640 
    Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess
    /usr/lib/libobjc.A.dylib _objc_exception_throw
    Frameworks/CoreFoundation.framework/CoreFoundation -[NSObject(NSObject) doesNotRecognizeSelector:]
    Frameworks/CoreFoundation.framework/CoreFoundation ____forwarding___
    Frameworks/CoreFoundation.framework/CoreFoundation ___forwarding_prep_0___
    Frameworks/QuartzCore.framework/QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
    Frameworks/IOKit.framework/Versions/A/IOKit _IODispatchCalloutFromCFMessage
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFMachPortPerform
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopDoSource1
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopRun
    Frameworks/CoreFoundation.framework/CoreFoundation _CFRunLoopRunSpecific
    PrivateFrameworks/GraphicsServices.framework/GraphicsServices _GSEventRunModal
    PrivateFrameworks/UIKitCore.framework/UIKitCore _UIApplicationMain
    deer _mh_execute_header
    /usr/lib/system/libdyld.dylib _start

react-native info:

System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 151.32 MB / 16.00 GB
    Shell: 5.6.2 - /usr/local/bin/zsh
  Binaries:
    Node: 10.14.2 - /usr/local/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 26, 27, 28
      Build Tools: 26.0.2, 26.0.3, 27.0.3, 28.0.3
      System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
  IDEs:
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2

One interest finding is that the devices having this issue are confined to iPhone 7 Plus(37.3%), iPhone 6S(32.0%), iPhone 7(21.3%), iPhone SE(6.7%) - old devices on iOS 13.3.1 or 13.4.1. Probably I should test with one of these devices first. Will get back if I have any more finding.

All 28 comments

Has anyone encountered a similar situation?

Same issue with me.
Anyone could you please provide solution of this

react-issue

Please help of this issue

same here. started seeing this since 0.61 in our user crashlogs 🤕

here's the full stacktrace
NSInvalidArgumentException -[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x2827a68c0 Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess /usr/lib/libobjc.A.dylib _objc_exception_throw Frameworks/CoreFoundation.framework/CoreFoundation -[NSObject(NSObject) doesNotRecognizeSelector:] Frameworks/CoreFoundation.framework/CoreFoundation ____forwarding___ Frameworks/CoreFoundation.framework/CoreFoundation ___forwarding_prep_0___ Frameworks/QuartzCore.framework/QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) Frameworks/IOKit.framework/Versions/A/IOKit _IODispatchCalloutFromCFMessage Frameworks/CoreFoundation.framework/CoreFoundation ___CFMachPortPerform Frameworks/CoreFoundation.framework/CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopDoSource1 Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopRun Frameworks/CoreFoundation.framework/CoreFoundation _CFRunLoopRunSpecific PrivateFrameworks/GraphicsServices.framework/GraphicsServices _GSEventRunModal PrivateFrameworks/UIKitCore.framework/UIKitCore _UIApplicationMain /Users/vagrant/git/ios/rituals/main.m:17:12 main /usr/lib/system/libdyld.dylib _start

I've tracked this back to this commit : https://github.com/facebook/react-native/commit/abf612aecd7f1ce310d611501cdb946e8903fb4f

@fkgozali any input on this ? 🙏

Last Exception Backtrace:
0 CoreFoundation 0x219f58518 __exceptionPreprocess + 228 (NSException.m:172)
1 libobjc.A.dylib 0x2191339f8 objc_exception_throw + 56 (objc-exception.mm:557)
2 CoreFoundation 0x219e75278 -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:323)
3 CoreFoundation 0x219f5dd60 ___forwarding___ + 1408 (NSForwarding.m:3224)
4 CoreFoundation 0x219f5f9fc _CF_forwarding_prep_0 + 92
5 QuartzCore 0x21e2ba194 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636 (CADisplay.mm:2332)
6 IOKit 0x21a1b4718 IODispatchCalloutFromCFMessage + 488 (IOKitLib.c:1216)
7 CoreFoundation 0x219ec3d30 __CFMachPortPerform + 188 (CFMachPort.c:522)
8 CoreFoundation 0x219eea934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56 (CFRunLoop.c:1996)
9 CoreFoundation 0x219eea080 __CFRunLoopDoSource1 + 440 (CFRunLoop.c:2133)
10 CoreFoundation 0x219ee4ea4 __CFRunLoopRun + 2096 (CFRunLoop.c:3152)
11 CoreFoundation 0x219ee4354 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
12 GraphicsServices 0x21c0e479c GSEventRunModal + 104 (GSEvent.c:2245)
13 UIKitCore 0x246357b68 UIApplicationMain + 212 (UIApplication.m:4353)
14 yakuodo 0x10422f540 main + 88 (main.m:14)
15 libdyld.dylib 0x2199aa8e0 start + 4

i think this commit makes this issue https://github.com/facebook/react-native/commit/6d6b532

Same issue here. Started seeing this since RN 0.61 in app crashlogs.
Just to mention that app crashes randomly on this issue, not always.
Please help.

Any update on this?

I got the same in crashlytics. Any solution yet?

any update on this? I got some crash becuase of this issue on store. do anyone have any solution?

Sorry for the lack of update. We haven't found any traces in FB production crashes that matched this issue, so it's hard to know how to address this.

Can someone create a minimal repro steps using a sample screen inside RNTester iOS? With smaller repro steps, it'll be easier to triage and find a solution.

@fkgozali
Actually it's same as this issue I think.
Already mentioned in comments but I leave the full backtrace here again:

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x212ed7180 __exceptionPreprocess
1  libobjc.A.dylib                0x2120af9f8 objc_exception_throw
2  CoreFoundation                 0x212df39bc -[NSOrderedSet initWithSet:copyItems:]
3  CoreFoundation                 0x212edc9c8 ___forwarding___
4  CoreFoundation                 0x212ede65c _CF_forwarding_prep_0
5  QuartzCore                     0x2172e7ff0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
6  IOKit                          0x2131344b0 IODispatchCalloutFromCFMessage
7  CoreFoundation                 0x212e42990 __CFMachPortPerform
8  CoreFoundation                 0x212e69594 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
9  CoreFoundation                 0x212e68ce0 __CFRunLoopDoSource1
10 CoreFoundation                 0x212e63b04 __CFRunLoopRun
11 CoreFoundation                 0x212e62fb4 CFRunLoopRunSpecific
12 GraphicsServices               0x21506479c GSEventRunModal
13 UIKitCore                      0x23f50ac38 UIApplicationMain
14 Project                        0x1006dc928 main + 16 (main.m:16)
15 libdyld.dylib                  0x2129268e0 start

and also here is my react-native info output:

 OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-4570R CPU @ 2.70GHz
    Memory: 238.51 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 21, 22, 23, 24, 25, 26, 27, 28
      Build Tools: 23.0.1, 23.0.2, 23.0.3, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

'm getting at least 1k crash every day becuase of this issue

@omid-zamani what makes you think those are related... ? 🤔

Already mentioned in comments but I leave the full backtrace here again:

Right, that's the stack trace, but we still don't have a solid way to reproduce the issue, i.e. what kind of code in your app triggered this crash?

https://github.com/facebook/react-native/issues/19078 is an old issue, I don't think it is related to RCTWeakProxy.

@fkgozali
Hey, I have a flatlist which load more than 20 images at a time. so when i scroll and my flat list reached almost 200 of images. My app crashed and throw this error. The images are WebP images and the size of the images are 500 x 500. Will be great if you able to help. Thanks.

@aibrahim3546

Hey, I have a flatlist which load more than 20 images at a time. so when i scroll and my flat list reached almost 200 of images. My app crashed and throw this error. The images are WebP images and the size of the images are 500 x 500. Will be great if you able to help. Thanks.

Any chance you could put your FlatList usage sample code somewhere in RNTester JS as a repro case? If we can repro the crash with RNTester, I think that would be a big step towards debugging the problem.

I am seeing this as well from my bugsnag, but could not get my head around where the issue stems from.

NSException object:

address
0
nsexception
{
  "name": "NSInvalidArgumentException",
  "referenced_object": {
    "ivars": {
      "_target": {
        "ivars": {
          "_currentTime": 0.00365243,
          "_currentFrame": {
            "address": 10771867776,
            "type": "objc_object",
            "class": "UIImage"
          },
          "_currentFrameIndex": 76,
          "_bufferMiss": false,
          "_totalLoopCount": 0,
          "_totalFrameCount": 209,
          "_currentLoopCount": 0,
          "_maxBufferSize": 0,
          "_animatedImage": {
            "address": 10777021184,
            "type": "objc_object",
            "class": "RCTAnimatedImage"
          },
          "_frameBuffer": {
            "address": 10756376800,
            "type": "objc_object",
            "class": "__NSDictionaryM"
          }
        },
        "type": "objc_object",
        "class": "RCTUIImageViewAnimated",
        "address": 4713924304
      }
    },
    "type": "objc_object",
    "class": "RCTWeakProxy",
    "address": 10754999872
  }
}
reason
-[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x2810c4640
type
nsexception

What would this exactly mean? Something to do with RCTUIImageViewAnimated?

Stack Trace:

NSInvalidArgumentException -[RCTWeakProxy displayDidRefresh:]: unrecognized selector sent to instance 0x2810c4640 
    Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess
    /usr/lib/libobjc.A.dylib _objc_exception_throw
    Frameworks/CoreFoundation.framework/CoreFoundation -[NSObject(NSObject) doesNotRecognizeSelector:]
    Frameworks/CoreFoundation.framework/CoreFoundation ____forwarding___
    Frameworks/CoreFoundation.framework/CoreFoundation ___forwarding_prep_0___
    Frameworks/QuartzCore.framework/QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
    Frameworks/IOKit.framework/Versions/A/IOKit _IODispatchCalloutFromCFMessage
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFMachPortPerform
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopDoSource1
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopRun
    Frameworks/CoreFoundation.framework/CoreFoundation _CFRunLoopRunSpecific
    PrivateFrameworks/GraphicsServices.framework/GraphicsServices _GSEventRunModal
    PrivateFrameworks/UIKitCore.framework/UIKitCore _UIApplicationMain
    deer _mh_execute_header
    /usr/lib/system/libdyld.dylib _start

react-native info:

System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 151.32 MB / 16.00 GB
    Shell: 5.6.2 - /usr/local/bin/zsh
  Binaries:
    Node: 10.14.2 - /usr/local/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 26, 27, 28
      Build Tools: 26.0.2, 26.0.3, 27.0.3, 28.0.3
      System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
  IDEs:
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2

One interest finding is that the devices having this issue are confined to iPhone 7 Plus(37.3%), iPhone 6S(32.0%), iPhone 7(21.3%), iPhone SE(6.7%) - old devices on iOS 13.3.1 or 13.4.1. Probably I should test with one of these devices first. Will get back if I have any more finding.

We found this commit that seems to address the issue: https://github.com/facebook/react-native/commit/e5a6655e71d41a58ce0e51d37aa9fb8792e37dd5

Maybe we can close this now?

Are any estimates on it?

We found this commit that seems to address the issue: e5a6655
Are any estimates on it?

Yes, this should be fixed in master. Closing

Hi @fkgozali, I'm using the v0.62, and I am still getting this issue. Is there any workaround to fix it until the v0.63 has been released?

Hi @fkgozali, I'm using the v0.62, and I am still getting this issue. Is there any workaround to fix it until the v0.63 has been released?

For a temp workaround, we applied a small patch inspired by https://github.com/facebook/react-native/pull/28070 through a postinstall script in package.json. Hope this helps!

#!/usr/bin/env bash
set -e

# Patch RCTWeakProxy.m until RN fixes https://github.com/facebook/react-native/issues/27463
OLD_LINE_WEAK_PROXY_ONE="- (id)forwardingTargetForSelector:(SEL)aSelector"
NEW_LINES_WEAK_PROXY_ONE="- (void)displayDidRefresh:(CADisplayLink *)displayLink /* patched */"
OLD_LINE_WEAK_PROXY_TWO="  return _target;"
NEW_LINES_WEAK_PROXY_TWO="  return [_target displayDidRefresh:displayLink]; /* patched */"
sed -i -e "s|${OLD_LINE_WEAK_PROXY_ONE}|${NEW_LINES_WEAK_PROXY_ONE}|" node_modules/react-native/React/Base/RCTWeakProxy.m
sed -i -e "s|${OLD_LINE_WEAK_PROXY_TWO}|${NEW_LINES_WEAK_PROXY_TWO}|" node_modules/react-native/React/Base/RCTWeakProxy.m

@DongDongDongDong I'm facing the same issue, Is there any solution yet? My react-native version is 0.62.2.

Anyone knows is this issue fixed in react-native version is 0.63?

same issue in Rn 0.63.3

Was this page helpful?
0 / 5 - 0 ratings