react-native-image-filter-kit icon indicating copy to clipboard operation
react-native-image-filter-kit copied to clipboard

[IOS]Crash when app backgrounded

Open kjossendal opened this issue 2 years ago • 5 comments

RN version: 0.66.0 RN-Filter-Kit version: 0.8.0 minimum ios version is 12

Have not checked on Android Bare workflow with expo-modules installed

As soon as app is moved to background an NSException gets thrown.

Exception NSException * "*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]" 0x00000002838899b0

I've tracked via breakpoint in xCode to IFKImageFilter.m at line 171

Exception	NSException *	"*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]"	0x00000002838899b0
name	__NSCFConstantString *	"NSInvalidArgumentException"	0x00000001dbcc1298
reason	__NSCFString *	"*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]"	0x0000000281917180
userInfo	void *	NULL	0x0000000000000000
reserved	void *	NULL	0x0000000000000000
acc	__NSDictionaryM *	7 key/value pairs	0x00000002833fb940
[0]	(null)	@"resizeCanvasTo" : 1 key/value pair	
[1]	(null)	@"hasColorManagement" : 1 key/value pair	
[2]	(null)	@"inputImage" : 1 key/value pair	
[3]	(null)	@"key" : @":[object Object]"	
[4]	(null)	@"swapImages" : 1 key/value pair	
[5]	(null)	@"name" : @"CIOverlayBlendMode"	
[6]	(null)	@"inputBackgroundImage" : 1 key/value pair	
key	__NSCFConstantString *	@"inputBackgroundImage"	0x00000001dbc99778
__NSCFString	__NSCFString	
idx	int	0
restImages	__NSSingleObjectArrayI *	@"1 element"	0x0000000283518f40
[0]	RCTImageView *	0x11fea12e0	0x000000011fea12e0

Our utilization in component is as follows

<OverlayBlend
        style={StyleSheet.absoluteFill}
        dstImage={
          <LinearGradient
            style={{ flex: 1 }}
            colors={[currentTrainer.secondary_color, currentTrainer.color]}
            start={{ y: '100h', x: '0w' }}
            end={{ x: 0, y: '0h' }}
            stops={[0, 1]}
          />
        }
        resizeCanvasTo={'dstImage'}
        srcImage={
          <ImageBackground
            style={{ width: '100%', height: '100%' }}
            resizeMode={'cover'}
            resizeMethod="resize"
            source={{
              uri: resolveLocalUrl(currentProgram.background_image_url),
            }}
          />
        }
      />

kjossendal avatar Mar 15 '22 17:03 kjossendal

      NSDictionary *completeConfig = [restImageNames reduce:^id(NSMutableDictionary *acc, NSString *key, int idx) {
        NSLog(@"Value on init %@", restImages[idx]);
        [acc setObject:@{@"image": [[CIImage alloc] initWithImage:[restImages[idx] image]]}
                forKey:key];

        return acc;
      } init:[NSMutableDictionary dictionaryWithDictionary:config]];

The above NSLog returns the following. My objective c knowledge is awful so if I'm looking at the complete wrong thing, please let me know. Value on init <RCTImageView: 0x119c5c9f0; reactTag: 1203; frame = (0 0; 414 896); clipsToBounds = YES; layer = <CALayer: 0x280c79120>>

kjossendal avatar Mar 15 '22 19:03 kjossendal

I'm unable to reproduce this. If anyone meet similar issue, please create a minimal repro.

iyegoroff avatar Apr 28 '22 04:04 iyegoroff

One more there, react native 0.69.1, latest version of image kit. Reproducible on simulator and on physical device

No expo, IOS 15.4

Navipro70 avatar Aug 19 '22 11:08 Navipro70

Still seeing this as well but I have little to add other than this appears to happen right after cache is cleared as I see ImageFilterKit: clear cache in xcode logs. It appears to happen when navigating from one screen with RNIFK to another screen also using RNIFK. Something isn't getting unloaded perhaps and causing conflicts. If I clear the navigation stack (ie using 'replace' instead of 'navigate' with react-navigation) when navigating between those two screens, I don't see the issue. I'll try to get a minimal reproduction app together but if you are running in to this, check your navigation.

kjossendal avatar Oct 18 '22 16:10 kjossendal

Has there been any progress made on this? We've got a build working just fine on iOS 16 that isn't working on iOS 15

calebpanza avatar Nov 16 '22 20:11 calebpanza