Closed marcshilling closed 8 months ago
Same issue after updating to xcode 15
Same issue after updating to xcode 15
Same issue here π, This message is printed to the xcode15 console before crashed:
@marcshilling Do you have any solution for the issue? I will be grateful for anything you can reply. π
So basically the breaking change from Xcode 13 -> 14 is now reverted with Xcode 14 -> 15? π
@ms314006 Just keep using Xcode 14 for now. I recommend using https://github.com/XcodesOrg/xcodes to manage Xcode versions. But we need to get this resolved eventually, because at some point next year Apple will likely require Xcode 15 for submissions.
@phatmovista Yes, but unfortunately reverting it is not an option because the app crashes when using the camera (the original reason the change was put in: https://github.com/mrousavy/react-native-vision-camera/pull/1308)
@mrousavy this is hitting us too. Does V3 work with Xcode 15 or is this bug also present in V3?
Facing the same issue. App crashes on launch.
Facing the same issue! Any workarounds for this on xcode 15?
Yep, same issue. Xcode 15 (15A240d).
Same issue here. It works with Xcode 14, but can't build for iOS 17.
This should be related to this https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1727199001
Downgraded to 14.3.1. It worked.
I'm on version 2.15.4 and had to replace
+(void)load
with
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)()
in two lines in the file ./ios/Frame Processor/FrameProcessorPlugin.h
:
This avoids the initial crash. Haven't tried the camera which I assume will crash as stated in https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1727739161.
I'm on version 2.15.4 and had to replace
+(void)load
with
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)()
in two lines in the file
./ios/Frame Processor/FrameProcessorPlugin.h
:This avoids the initial crash. Haven't tried the camera which I assume will crash as stated in #1307 (comment).
Thank you, that's worked for me!
Note: I am using RN 0.68.2 here.
@gabrielmaldi @DanielAraldi be warned (I mentioned this in my original comment), the reversion fixes the startup crash but the original crash (using the camera with a frame processor) will pop back up, making the fix unusable
Yes, this is a temporary fix to be able to at least work on the rest of the app. Thanks a lot.
I'm on version 2.15.4 and had to replace
+(void)load
with
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)()
in two lines in the file
./ios/Frame Processor/FrameProcessorPlugin.h
:This avoids the initial crash. Haven't tried the camera which I assume will crash as stated in #1307 (comment).
still got this issue on RN 0.69.3
The quick fix for now is to revert this change - https://github.com/mrousavy/react-native-vision-camera/pull/1308/files
Replacing vision-camera-code-scanner
with react-native-camera-kit
.
That solved the issue for me.
crash is resolved with this. thx
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)()
however I can't use camera.
"react-native-vision-camera": "2.16.1",
"react-native": "0.68.7",
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
return [objc_name callback:frame withArgs:args]; \
}]; \
}
This should solve the issue permanently - https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1731248952
This should solve the issue permanently - #1307 (comment)
Still get the red screen above "Frame Processors are not enabled...". I'm on 2.15.4 and changing my FrameProcessorPlugin.h like below according to the solution above didn't help. Obviously did a clean build. What am i missing? :)
//
// FrameProcessorPlugin.h
// VisionCamera
//
// Created by Marc Rousavy on 01.05.21.
// Copyright Β© 2021 mrousavy. All rights reserved.
//
#ifndef FrameProcessorPlugin_h
#define FrameProcessorPlugin_h
#import <Foundation/Foundation.h>
#import "FrameProcessorPluginRegistry.h"
#import "Frame.h"
@protocol FrameProcessorPluginBase
+ (id) callback:(Frame*)frame withArgs:(NSArray<id>*)args;
@end
#define VISION_CONCAT2(A, B) A##B
#define VISION_CONCAT(A, B) VISION_CONCAT2(A, B)
/**
* Use this Macro to register the given function as a Frame Processor.
* * Make sure the given function is a C-style function with the following signature: static inline id callback(Frame* frame, NSArray* args)
* * Make sure the given function's name is unique across other frame processor plugins
* * Make sure your frame processor returns a Value that can be converted to JS
* * Make sure to use this Macro in an @implementation, not @interface
*
* The JS function will have the same name as the given Objective-C function, but with a "__" prefix.
* Make sure to add that function to the babel.config.js under reanimated's "globals" option, and add TypeScript type declarations.
*/
#define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \
\
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \
return frame_processor(frame, args); \
}]; \
}
/**
* Same as VISION_EXPORT_FRAME_PROCESSOR, but uses __attribute__((constructor)) for
* registration. Useful for registering swift classes that forbids use of +(void)load.
*/
#define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \
objc_name : NSObject<FrameProcessorPluginBase> \
@end \
\
@interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \
@end \
@implementation objc_name (FrameProcessorPlugin) \
\
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
return [objc_name callback:frame withArgs:args]; \
}]; \
}
#endif /* FrameProcessorPlugin_h */
edit: and chrome dubug not connected etc. This was working before xcode 15/ios 17.
#define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(frame_processor) \
\
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
Should be
#define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(frame_processor) \
+(void)load \
@frenberg
"react-native-vision-camera": "2.15.4",
"react-native": "0.68.7",
#define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \
...
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
@2sem You also need to make this change https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1731248952
My 2.15.4 FrameProcessorPlugin
#define VISION_CONCAT2(A, B) A##B
#define VISION_CONCAT(A, B) VISION_CONCAT2(A, B)
/**
* Use this Macro to register the given function as a Frame Processor.
* * Make sure the given function is a C-style function with the following signature: static inline id callback(Frame* frame, NSArray* args)
* * Make sure the given function's name is unique across other frame processor plugins
* * Make sure your frame processor returns a Value that can be converted to JS
* * Make sure to use this Macro in an @implementation, not @interface
*
* The JS function will have the same name as the given Objective-C function, but with a "__" prefix.
* Make sure to add that function to the babel.config.js under reanimated's "globals" option, and add TypeScript type declarations.
*/
#define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \
\
+(void)load \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \
return frame_processor(frame, args); \
}]; \
}
/**
* Same as VISION_EXPORT_FRAME_PROCESSOR, but uses __attribute__((constructor)) for
* registration. Useful for registering swift classes that forbids use of +(void)load.
*/
#define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \
objc_name : NSObject<FrameProcessorPluginBase> \
@end \
\
@interface objc_name (FrameProcessorPlugin) \
@end \
@implementation objc_name (FrameProcessorPlugin) \
\
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
return [objc_name callback:frame withArgs:args]; \
}]; \
}
Hi, got the same issue. (2.16.1)
Managed to fix crashing on startup with https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1731248952
But still got an error when trying to use frame processor: frame-processor/unavailable: Frame Processors are not enabled.
Anything else im missing?
My FrameProcessorPlugin.h
//
// FrameProcessorPlugin.h
// VisionCamera
//
// Created by Marc Rousavy on 01.05.21.
// Copyright Β© 2021 mrousavy. All rights reserved.
//
#ifndef FrameProcessorPlugin_h
#define FrameProcessorPlugin_h
#import <Foundation/Foundation.h>
#import "FrameProcessorPluginRegistry.h"
#import "Frame.h"
@protocol FrameProcessorPluginBase
+ (id) callback:(Frame*)frame withArgs:(NSArray<id>*)args;
@end
#define VISION_CONCAT2(A, B) A##B
#define VISION_CONCAT(A, B) VISION_CONCAT2(A, B)
/**
* Use this Macro to register the given function as a Frame Processor.
* * Make sure the given function is a C-style function with the following signature: static inline id callback(Frame* frame, NSArray* args)
* * Make sure the given function's name is unique across other frame processor plugins
* * Make sure your frame processor returns a Value that can be converted to JS
* * Make sure to use this Macro in an @implementation, not @interface
*
* The JS function will have the same name as the given Objective-C function, but with a "__" prefix.
* Make sure to add that function to the babel.config.js under reanimated's "globals" option, and add TypeScript type declarations.
*/
#define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \
\
+(void)load \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \
return frame_processor(frame, args); \
}]; \
}
/**
* Same as VISION_EXPORT_FRAME_PROCESSOR, but uses __attribute__((constructor)) for
* registration. Useful for registering swift classes that forbids use of +(void)load.
*/
#define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \
objc_name : NSObject<FrameProcessorPluginBase> \
@end \
\
@interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \
@end \
@implementation objc_name (FrameProcessorPlugin) \
\
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
return [objc_name callback:frame withArgs:args]; \
}]; \
}
#endif /* FrameProcessorPlugin_h */
@Thormeard, it's final change, worked for me. But only to "react-native-vision-camera": "2.15.2", if I update "react-native-vision-camera" to 2.16.1 I got error(Frame processors not enabled) again, I don't know why .
//
// FrameProcessorPlugin.h
// VisionCamera
//
// Created by Marc Rousavy on 01.05.21.
// Copyright Β© 2021 mrousavy. All rights reserved.
//
#ifndef FrameProcessorPlugin_h
#define FrameProcessorPlugin_h
#import <Foundation/Foundation.h>
#import "FrameProcessorPluginRegistry.h"
#import "Frame.h"
@protocol FrameProcessorPluginBase
+ (id) callback:(Frame*)frame withArgs:(NSArray<id>*)args;
@end
#define VISION_CONCAT2(A, B) A##B
#define VISION_CONCAT(A, B) VISION_CONCAT2(A, B)
/**
* Use this Macro to register the given function as a Frame Processor.
* * Make sure the given function is a C-style function with the following signature: static inline id callback(Frame* frame, NSArray* args)
* * Make sure the given function's name is unique across other frame processor plugins
* * Make sure your frame processor returns a Value that can be converted to JS
* * Make sure to use this Macro in an @implementation, not @interface
*
* The JS function will have the same name as the given Objective-C function, but with a "__" prefix.
* Make sure to add that function to the babel.config.js under reanimated's "globals" option, and add TypeScript type declarations.
*/
#define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \
\
+(void)load \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \
return frame_processor(frame, args); \
}]; \
}
/**
* Same as VISION_EXPORT_FRAME_PROCESSOR, but uses __attribute__((constructor)) for
* registration. Useful for registering swift classes that forbids use of +(void)load.
*/
#define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \
objc_name : NSObject<FrameProcessorPluginBase> \
@end \
\
@interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \
@end \
@implementation objc_name (FrameProcessorPlugin) \
\
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
return [objc_name callback:frame withArgs:args]; \
}]; \
}
#endif /* FrameProcessorPlugin_h */
If you have patch-package you can apply this:
diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
index 9408774..64180c7 100644
--- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
+++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
@@ -49,11 +49,11 @@
objc_name : NSObject<FrameProcessorPluginBase> \
@end \
\
-@interface objc_name (FrameProcessorPlugin) \
+@interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \
@end \
@implementation objc_name (FrameProcessorPlugin) \
\
-+(void)load \
+__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
return [objc_name callback:frame withArgs:args]; \
Also If you have firebase with use_frameworks! :linkage => :static
in your pods this can help you (this case give same error: Frame processors not enabled ):
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name.eql?('VisionCamera') || pod.name.eql?('RNReanimated')
Pod::UI.puts "#{pod.name}: Using overridden static_framework value of 'true'"
def pod.build_type
Pod::BuildType.static_library
end
end
end
end
https://github.com/mrousavy/react-native-vision-camera/issues/1840#issuecomment-1734259756
@Thormeard, it's final change, worked for me. But only to "react-native-vision-camera": "2.15.2", if I update "react-native-vision-camera" to 2.16.1 I got error(Frame processors not enabled) again, I don't know why .
// // FrameProcessorPlugin.h // VisionCamera // // Created by Marc Rousavy on 01.05.21. // Copyright Β© 2021 mrousavy. All rights reserved. // #ifndef FrameProcessorPlugin_h #define FrameProcessorPlugin_h #import <Foundation/Foundation.h> #import "FrameProcessorPluginRegistry.h" #import "Frame.h" @protocol FrameProcessorPluginBase + (id) callback:(Frame*)frame withArgs:(NSArray<id>*)args; @end #define VISION_CONCAT2(A, B) A##B #define VISION_CONCAT(A, B) VISION_CONCAT2(A, B) /** * Use this Macro to register the given function as a Frame Processor. * * Make sure the given function is a C-style function with the following signature: static inline id callback(Frame* frame, NSArray* args) * * Make sure the given function's name is unique across other frame processor plugins * * Make sure your frame processor returns a Value that can be converted to JS * * Make sure to use this Macro in an @implementation, not @interface * * The JS function will have the same name as the given Objective-C function, but with a "__" prefix. * Make sure to add that function to the babel.config.js under reanimated's "globals" option, and add TypeScript type declarations. */ #define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \ \ +(void)load \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \ return frame_processor(frame, args); \ }]; \ } /** * Same as VISION_EXPORT_FRAME_PROCESSOR, but uses __attribute__((constructor)) for * registration. Useful for registering swift classes that forbids use of +(void)load. */ #define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \ objc_name : NSObject<FrameProcessorPluginBase> \ @end \ \ @interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \ @end \ @implementation objc_name (FrameProcessorPlugin) \ \ __attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \ return [objc_name callback:frame withArgs:args]; \ }]; \ } #endif /* FrameProcessorPlugin_h */
If you have patch-package you can apply this:
diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h index 9408774..64180c7 100644 --- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h +++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h @@ -49,11 +49,11 @@ objc_name : NSObject<FrameProcessorPluginBase> \ @end \ \ -@interface objc_name (FrameProcessorPlugin) \ +@interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \ @end \ @implementation objc_name (FrameProcessorPlugin) \ \ -+(void)load \ +__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \ return [objc_name callback:frame withArgs:args]; \
Also If you have firebase with
use_frameworks! :linkage => :static
in your pods this can help you (this case give same error: Frame processors not enabled ):pre_install do |installer| installer.pod_targets.each do |pod| if pod.name.eql?('VisionCamera') || pod.name.eql?('RNReanimated') Pod::UI.puts "#{pod.name}: Using overridden static_framework value of 'true'" def pod.build_type Pod::BuildType.static_library end end end end
And to make v2 work on iPhone 15 you need to add the following to your patch, and build using xcode 15/ios skd 17
diff --git a/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift b/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift
index 13a403b..9b30f62 100644
--- a/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift
+++ b/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift
@@ -24,6 +24,13 @@ extension AVCaptureColorSpace {
case "srgb":
self = .sRGB
return
+ case "appleLog":
+ if #available(iOS 17, *) {
+ self = .appleLog
+ } else {
+ throw EnumParserError.unsupportedOS(supportedOnOS: "17")
+ }
+ return
default:
throw EnumParserError.invalidValue
}
@@ -37,6 +44,8 @@ extension AVCaptureColorSpace {
return "p3-d65"
case .sRGB:
return "srgb"
+ case .appleLog:
+ return "appleLog"
default:
fatalError("AVCaptureDevice.Position has unknown state.")
}
@Thormeard, it's final change, worked for me. But only to "react-native-vision-camera": "2.15.2", if I update "react-native-vision-camera" to 2.16.1 I got error(Frame processors not enabled) again, I don't know why .
// // FrameProcessorPlugin.h // VisionCamera // // Created by Marc Rousavy on 01.05.21. // Copyright Β© 2021 mrousavy. All rights reserved. // #ifndef FrameProcessorPlugin_h #define FrameProcessorPlugin_h #import <Foundation/Foundation.h> #import "FrameProcessorPluginRegistry.h" #import "Frame.h" @protocol FrameProcessorPluginBase + (id) callback:(Frame*)frame withArgs:(NSArray<id>*)args; @end #define VISION_CONCAT2(A, B) A##B #define VISION_CONCAT(A, B) VISION_CONCAT2(A, B) /** * Use this Macro to register the given function as a Frame Processor. * * Make sure the given function is a C-style function with the following signature: static inline id callback(Frame* frame, NSArray* args) * * Make sure the given function's name is unique across other frame processor plugins * * Make sure your frame processor returns a Value that can be converted to JS * * Make sure to use this Macro in an @implementation, not @interface * * The JS function will have the same name as the given Objective-C function, but with a "__" prefix. * Make sure to add that function to the babel.config.js under reanimated's "globals" option, and add TypeScript type declarations. */ #define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \ \ +(void)load \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \ return frame_processor(frame, args); \ }]; \ } /** * Same as VISION_EXPORT_FRAME_PROCESSOR, but uses __attribute__((constructor)) for * registration. Useful for registering swift classes that forbids use of +(void)load. */ #define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \ objc_name : NSObject<FrameProcessorPluginBase> \ @end \ \ @interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \ @end \ @implementation objc_name (FrameProcessorPlugin) \ \ __attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \ return [objc_name callback:frame withArgs:args]; \ }]; \ } #endif /* FrameProcessorPlugin_h */
If you have patch-package you can apply this:
diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h index 9408774..64180c7 100644 --- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h +++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h @@ -49,11 +49,11 @@ objc_name : NSObject<FrameProcessorPluginBase> \ @end \ \ -@interface objc_name (FrameProcessorPlugin) \ +@interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \ @end \ @implementation objc_name (FrameProcessorPlugin) \ \ -+(void)load \ +__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \ return [objc_name callback:frame withArgs:args]; \
Also If you have firebase with
use_frameworks! :linkage => :static
in your pods this can help you (this case give same error: Frame processors not enabled ):pre_install do |installer| installer.pod_targets.each do |pod| if pod.name.eql?('VisionCamera') || pod.name.eql?('RNReanimated') Pod::UI.puts "#{pod.name}: Using overridden static_framework value of 'true'" def pod.build_type Pod::BuildType.static_library end end end end
This patch seems to be working for me! thanks!
@marcshilling You can try this patch.
@Thormeard, it's final change, worked for me. But only to "react-native-vision-camera": "2.15.2", if I update "react-native-vision-camera" to 2.16.1 I got error(Frame processors not enabled) again, I don't know why .
// // FrameProcessorPlugin.h // VisionCamera // // Created by Marc Rousavy on 01.05.21. // Copyright Β© 2021 mrousavy. All rights reserved. // #ifndef FrameProcessorPlugin_h #define FrameProcessorPlugin_h #import <Foundation/Foundation.h> #import "FrameProcessorPluginRegistry.h" #import "Frame.h" @protocol FrameProcessorPluginBase + (id) callback:(Frame*)frame withArgs:(NSArray<id>*)args; @end #define VISION_CONCAT2(A, B) A##B #define VISION_CONCAT(A, B) VISION_CONCAT2(A, B) /** * Use this Macro to register the given function as a Frame Processor. * * Make sure the given function is a C-style function with the following signature: static inline id callback(Frame* frame, NSArray* args) * * Make sure the given function's name is unique across other frame processor plugins * * Make sure your frame processor returns a Value that can be converted to JS * * Make sure to use this Macro in an @implementation, not @interface * * The JS function will have the same name as the given Objective-C function, but with a "__" prefix. * Make sure to add that function to the babel.config.js under reanimated's "globals" option, and add TypeScript type declarations. */ #define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \ \ +(void)load \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \ return frame_processor(frame, args); \ }]; \ } /** * Same as VISION_EXPORT_FRAME_PROCESSOR, but uses __attribute__((constructor)) for * registration. Useful for registering swift classes that forbids use of +(void)load. */ #define VISION_EXPORT_SWIFT_FRAME_PROCESSOR(name, objc_name) \ objc_name : NSObject<FrameProcessorPluginBase> \ @end \ \ @interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \ @end \ @implementation objc_name (FrameProcessorPlugin) \ \ __attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \ return [objc_name callback:frame withArgs:args]; \ }]; \ } #endif /* FrameProcessorPlugin_h */
If you have patch-package you can apply this:
diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h index 9408774..64180c7 100644 --- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h +++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h @@ -49,11 +49,11 @@ objc_name : NSObject<FrameProcessorPluginBase> \ @end \ \ -@interface objc_name (FrameProcessorPlugin) \ +@interface objc_name (FrameProcessorPlugin) <FrameProcessorPluginBase> \ @end \ @implementation objc_name (FrameProcessorPlugin) \ \ -+(void)load \ +__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \ return [objc_name callback:frame withArgs:args]; \
Also If you have firebase with
use_frameworks! :linkage => :static
in your pods this can help you (this case give same error: Frame processors not enabled ):pre_install do |installer| installer.pod_targets.each do |pod| if pod.name.eql?('VisionCamera') || pod.name.eql?('RNReanimated') Pod::UI.puts "#{pod.name}: Using overridden static_framework value of 'true'" def pod.build_type Pod::BuildType.static_library end end end end
Can confirm, fixes issue for me BUT only on 2.15.2 (not on latest 2.16.1). Thanks!
Xcode 15, ios 17, iPhone X
I'm on version 2.15.4 and had to replace
+(void)load
with
__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)()
in two lines in the file
./ios/Frame Processor/FrameProcessorPlugin.h
:This avoids the initial crash. Haven't tried the camera which I assume will crash as stated in #1307 (comment).
Thank you ^ 999999999999
Confirming the patch posted by @Letitbe93 has me back in business in conjunction with what @frenberg posted (to fix #1840). Building with Xcode 15 and barcode scanning working well on my iPhone 15 Pro π
I can confirm the FrameProccessor patch (https://github.com/mrousavy/react-native-vision-camera/issues/1802#issuecomment-1735681593) work on XCode 15 with iOS 16 + RN0.70 + react-native-vision-camera@2.15.6 + react-native-reanimated@2.17.0, android need further testing but it should work.
* it seems that v2.16 has some changes on FrameProcessor so we may need to stick to v2.15.6 for a while ... @mrousavy or other contributor can make a patch on 2.15 branch to fix XCode 15 and iPhone 15 issues first.
here is the diff for quick check https://github.com/mrousavy/react-native-vision-camera/compare/v2.15.6...v2.16.0
Hey - yea please submit a PR instead of creating random patches. Then I can merge and backport it.
if you upgrade the macOS to Sonoma you can't use xcode v14 anymore and this problem happens only on xcode v15 with xcode tools v15 π€·ββοΈ
Any fix for this issue. I am using
Xcode 15 ,
"react-native-vision-camera": "2.15.4",
iOS :17
App is crashing on my simulator after launch.
if you upgrade the macOS to Sonoma you can't use xcode v14 anymore and this problem happens only on xcode v15 with xcode tools v15 π€·ββοΈ
I have an M2 on Sonoma running XCode 14.3.1
sudo xcode-select -s /Applications/XCode_14.app/
to use the v14 app by defaultif you upgrade the macOS to Sonoma you can't use xcode v14 anymore and this problem happens only on xcode v15 with xcode tools v15 π€·ββοΈ
I have an M2 on Sonoma running XCode 14.3.1
- download 14.x: https://developer.apple.com/download/applications/
- open dmg and paste+rename the app to your Applications folder (like XCode_14)
sudo xcode-select -s /Applications/XCode_14.app/
to use the v14 app by default
I just did everything you mentioned but I can't open the new Xcode I installed, but I can't open the version I downloaded, when I run the command sudo xcode-select -s /Applications/XCode_14.app/
and then sudo xcode-select -p
It shows that I am using the new version that I installed > /Applications/Xcode_14.app/Contents/Developer
I don't know if this is right or if I have to do something additional.
My app runs fine on simulator, RN 0.68.2 but crashes in react core pod RCTCxxBridge file - at _reactInstance.reset(new Instance); when I try running on device. iOS - 17, iphone 15, xcode 15
gettins this issue also on xcode 15 + iOS 17+ vision camera 3.3.1.
This patch worked for me!
react-native: 0.71.13 react-native-camera-vision: 2.15.4 xcode: 15 macos: 14.0
Create file patch with name -> ./patches/react-native-vision-camera+2.15.4.patch
Past content below to file
npx patch-package
diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
index 9408774..2aa04dc 100644
--- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
+++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
@@ -33,7 +33,7 @@
*/
#define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \
\
-+(void)load \
+__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \
return frame_processor(frame, args); \
@@ -53,7 +53,7 @@ objc_name : NSObject<FrameProcessorPluginBase>
@end \
@implementation objc_name (FrameProcessorPlugin) \
\
-+(void)load \
+__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \
{ \
[FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
return [objc_name callback:frame withArgs:args]; \
PD-6078 fix: Swift class extensions and categories on Swift classes are not allowed to have +load methods team-olulo/react-native-vision-camera#4
Yes, I also encountered the problem in 3.3.0 but couldn't solve itγ
https://github.com/mrousavy/react-native-vision-camera/issues/1987
This patch worked for me!
react-native: 0.71.13 react-native-camera-vision: 2.15.4 xcode: 15 macos: 14.0
Create file patch with name -> ./patches/react-native-vision-camera+2.15.4.patch
Past content below to file
npx patch-package
diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h index 9408774..2aa04dc 100644 --- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h +++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h @@ -33,7 +33,7 @@ */ #define VISION_EXPORT_FRAME_PROCESSOR(frame_processor) \ \ -+(void)load \ +__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #frame_processor callback:^id(Frame* frame, NSArray<id>* args) { \ return frame_processor(frame, args); \ @@ -53,7 +53,7 @@ objc_name : NSObject<FrameProcessorPluginBase> @end \ @implementation objc_name (FrameProcessorPlugin) \ \ -+(void)load \ +__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)() \ { \ [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \ return [objc_name callback:frame withArgs:args]; \
But this opens new issue for me on Android. I endup getting error when launching camera- frame-processor/unavailable: Frame Processors are not enabled. See https://react-native-vision-camera.com/docs/guides/troubleshooting, js engine: hermes
iphone 15 pro, iphone 15 pro max xcode 15 v 2.15.6 I fixed the crash problem on startup and the camera also works patch file:
diff --git a/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift b/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift
index 13a403b..6d0ece2 100644
--- a/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift
+++ b/node_modules/react-native-vision-camera/ios/Parsers/AVCaptureColorSpace+descriptor.swift
@@ -24,6 +24,13 @@ extension AVCaptureColorSpace {
case "srgb":
self = .sRGB
return
+ case "appleLog":
+ if #available(iOS 17, *) {
+ self = .appleLog
+ } else {
+ throw EnumParserError.unsupportedOS(supportedOnOS: "17")
+ }
+ return
default:
throw EnumParserError.invalidValue
}
@@ -37,8 +44,10 @@ extension AVCaptureColorSpace {
return "p3-d65"
case .sRGB:
return "srgb"
+ case .appleLog:
+ return "appleLog"
default:
- fatalError("AVCaptureDevice.Position has unknown state.")
+ return "unknown"
}
}
}
This isn't a solution but if you want a workaround that doesn't totally kill quality this works for me on iOS & Android:
useCameraFormat(camera, [{videoResolution: 'max'}])
and
cameraRef?.current?.takePhoto({
qualityPrioritization: 'balanced', // Maybe doesnt matter, havent tested
});
useCameraFormat
is from V3, I don't think V2 has this?
Yeah I'm silly, I got here through another issue- I probably should have properly read this properly before commenting- My issue was crash when taking photos with iso: max
currently i'm using RN:0.70 VISION-CAMERA:2.14.1 REANIMATED:2.10.0 XCODE 14 ISSUE: VISION-CAMERA-FACE-RECOGNITION CRASH
Experienced this issue for V3 on XCode 15.0, updating to 15.2 solved the problem
What's happening?
When built using Xcode 15 release candidate, the app is crashing at launch. Before the crash, the message
Swift class extensions and categories on Swift classes are not allowed to have +load methods
is printed to the console.Relevant info - I'm also using
vision-camera-code-scanner@0.2.0
for barcode scanning.It seems to be related to https://github.com/mrousavy/react-native-vision-camera/pull/1308. If I revert that change, the startup crash goes away, but then when trying to use the camera it lags and then crashes (probably the original issue)
My workaround for now is continuing to use Xcode 14 to build.
Reproduceable Code
Relevant log output
Camera Device
Device
iPhone 14 Pro
VisionCamera Version
2.15.4
Can you reproduce this issue in the VisionCamera Example app?
Additional information
Upvote & Fund