Does not build in 76.0 in new arch for ios
Build logs
#if RCT_NEW_ARCH_ENABLED #import <ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h> #endif
@sayem314 - Please fix it when you have time.
Send screenshot of error. I haven't touched RN in a while.
This is the error which xcode gave out.
It works well in android.
@sayem314 as new arch is enabled, it just said this module is not found.
I've just run into the same issue on RN 0.75.4 with the new architecture enabled. It was previously working with the new architecture on RN 0.74.
'ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h' file not found
Hi there! Same issue here with React Native 0.76.1 and new Arch enabled.
Same here. Issue with with RN 0.76.1 and Xcode
** BUILD FAILED **
The following build commands failed:
CompileC /Users/amin/Library/Developer/Xcode/DerivedData/myapp-ehkjrileckhvxbafzuvenijgdutp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-keep-awake.build/Objects-normal/arm64/ReactNativeKCKeepAwake.o /Users/amin/Projects/myapp/app/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'react-native-keep-awake' from project 'Pods')
Building workspace myapp with scheme myapp and configuration Debug
(2 failures)
@sayem314 - Any fixes?
Change the import path to #import <ReactCodegen/ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h>
I also added PR for it #18
@Gautham495 can you install directly from main github branch now and check if it’s working so i can push to npm.
@sayem314 I just tried installing from master branch on my app and seems to be working correctly!
I did it this way: "@sayem314/react-native-keep-awake": "https://github.com/sayem314/react-native-keep-awake.git", on package.json / dependencies
The built is now working! Thanks for the update!
Published @sayem314/[email protected]
I’m trying to build using version 0.76.5. I’ve used the upgrade helper to modify the necessary files, but when I run the build command, it exits with exit code 65 in Xcode. Is there any other solution to fix this?
@jwhan-dix see https://circleci.com/blog/xcodebuild-exit-code-65-what-it-is-and-how-to-solve-for-ios-and-macos-builds/
@sayem314 It wasn't directly helpful, but I managed to fix the error. Thank you!😂
Same issue! What's the solution. I'm using 1.3.0
#import <ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h>
I am building in RN 0.77, but did not mange to fix the issue so I removed the new arch all together.
Patch
diff --git a/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.h b/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.h
index 43749db..b9dccd1 100644
--- a/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.h
+++ b/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.h
@@ -6,14 +6,5 @@
#import "React/RCTBridgeModule.h"
#endif
-#if RCT_NEW_ARCH_ENABLED
-#import <ReactCodegen/ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h>
-#endif
-
@interface ReactNativeKCKeepAwake : NSObject <RCTBridgeModule>
@end
-
-#if RCT_NEW_ARCH_ENABLED
-@interface ReactNativeKCKeepAwake () <NativeKCKeepAwakeSpec>
-@end
-#endif
diff --git a/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.mm b/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.mm
index bdd992c..c806172 100644
--- a/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.mm
+++ b/node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.mm
@@ -2,11 +2,6 @@
#import "UIKit/UIKit.h"
-#if RCT_NEW_ARCH_ENABLED
-#import <ReactCodegen/ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h>
-#endif
-
-
@implementation ReactNativeKCKeepAwake
RCT_EXPORT_MODULE();
@@ -25,14 +20,5 @@ @implementation ReactNativeKCKeepAwake
});
}
-# pragma mark - New Architecture
-#if RCT_NEW_ARCH_ENABLED
-- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
- (const facebook::react::ObjCTurboModule::InitParams &)params
-{
- return std::make_shared<facebook::react::NativeKCKeepAwakeSpecJSI>(params);
-}
-#endif
-
@end
This issue appear again in 0.77 My workaround https://github.com/sayem314/react-native-keep-awake/issues/20#issuecomment-2653042261
Yes it looks like this issue reappeared in react-native 0.77 and @sayem314/react-native-keep-awake 1.3.0, but this time with ReactCodegen in import path.
error 'ReactCodegen/ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h' file not found
Would love for this issue to be properly solved as it seems to just be a simple problem of importing a library. As a temporary fix (tested with React Native 0.77.1), if you want to keep the new React Native architecture:
- Open both node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.h and node_modules/@sayem314/react-native-keep-awake/ios/ReactNativeKCKeepAwake.mm
- Change the following import statement:
- From: #import <ReactCodegen/ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h>
- To: #import <absolute_or_relative_path_to_project/ios/build/generated/ios/ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h>
- For example, in my project, the relative import path would be: #import <../../../../ios/build/generated/ios/ReactNativeKCKeepAwakeSpec/ReactNativeKCKeepAwakeSpec.h>
The annoying part is that whenever you delete node_modules folder, you are going to have to redo the above steps.
thx @oserrabassa-jcm I applied your suggestion and I manage to build the project with React Native 0.78.1
Import issue should be fixed in v1.3.1