-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modules #247
Comments
Having this same issue as well. Any help on this would be great! |
Okay, so as a workaround I discovered I can create a separate header file and an objective-c file to wrap the Adobe SDK setup, then import it into the main AppDelegate.... AdobeBridge.h: #import <Foundation/Foundation.h>
@interface AdobeBridge : NSObject
+ (void)configureAnalytics;
@end AdobeBridge.m: #import "AdobeBridge.h"
@import AEPCore;
@implementation AdobeBridge
+ (void)configureAnalytics
{
[AEPMobileCore configureWithAppId:@"app_id_here"];
}
@end And in AppDelegate.mm: [super application:application didFinishLaunchingWithOptions:launchOptions];
[AdobeBridge configureAnalytics];
return YES; Very strange that a direct reference does work for a vanilla react native project, but this extra step is required for react native with expo. This method works, but I would love to figure out why the normal process isn't suitable here Working sample: |
@JoeM-RP Thanks, |
Hey, This issue is not expo specific, as it also happens on react-native Bare. It's a native compiler error. You can try enabling the In Xcode
@JoeM-RP I do like your workaround with separate files!👌 Helps keeps AppDelegate.mm cleaner. |
@JoeM-RP - I took your approach for a RN 72 Expo SDK 49 bare app and am running into issues getting other extensions to register. This approach is still giving me errors when I include the remaining code required to set up the AEP extensions " const UIApplicationState appState = application.applicationState; I get an error stating I have added the above code to your AdobeBridge.m file assuming it more or less takes the place of any code that Adobe recommends be placed into the AppDelegate.mm file. Have you set up any AEP libraries/extensions like this other than the base Mobile Core? I specifically need to configure Edge Bridge because we use Analytics trackState and trackActions. |
@sdubey01 - at a glance, everything seems to line up. Here's a gist with the complete files for all three major pieces within iOS: https://gist.github.com/JoeM-RP/271758305aaa5d92a6d435cd85452994 ...and our abbreviated "dependencies": {
"@adobe/react-native-aepassurance": "^5.0.0",
"@adobe/react-native-aepcampaignclassic": "^5.0.0",
"@adobe/react-native-aepcore": "^5.0.1",
"@adobe/react-native-aepedge": "^5.0.0",
"@adobe/react-native-aepedgeconsent": "^5.0.0",
"@adobe/react-native-aepedgeidentity": "^5.0.0",
"@adobe/react-native-aepoptimize": "^5.0.0",
"@adobe/react-native-aepplaces": "^5.0.2",
"@adobe/react-native-aeptarget": "^5.0.0",
"@adobe/react-native-aepuserprofile": "^5.0.0",
"@expo/dev-server": "0.1.120",
"@expo/react-native-action-sheet": "^4.0.0",
"@expo/vector-icons": "^13.0.0",
"@expo/webpack-config": "^19.0.0",
"expo": "^49.0.16",
"expo-application": "~5.3.0",
"expo-asset": "~8.10.1",
"expo-av": "~13.4.1",
"expo-build-properties": "~0.8.3",
"expo-constants": "~14.4.2",
"expo-device": "~5.4.0",
"expo-font": "~11.4.0",
"expo-insights": "~0.2.0",
"expo-linear-gradient": "~12.3.0",
"expo-linking": "~5.0.2",
"expo-local-authentication": "~13.4.1",
"expo-localization": "~14.3.0",
"expo-network": "~5.4.0",
"expo-notifications": "~0.20.1",
"expo-screen-orientation": "~6.0.6",
"expo-secure-store": "~12.3.1",
"expo-sharing": "~11.5.0",
"expo-splash-screen": "~0.20.5",
"expo-system-ui": "~2.4.0",
"expo-updates": "~0.18.19",
"expo-web-browser": "~12.3.2",
"react": "18.2.0",
"react-native": "0.72.6",
} I'm not actively working with the product anymore, but maybe there's a conflict with a recent XCode update? |
Sadly my files match yours and it still fails. I'm on an M1 macbook, so possible the issue is there. Also possible that your suspicion of an Xcode update is to blame if you last had it working before Xcode 15.4. - Looks like I will table this attempt and try to get us upgraded to RN 73 Expo SDK 50 with the newest Adobe libraries (some are up to V 6.x now) ... maybe the Expo libs that prevent the official Adobe fix of adding in the -fcxx-modules build flag have been resolved. |
While attempting to add the AEPCore SDK to my iOS app, I encountered an issue preventing the code from compiling.
Use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modules
Expected Behaviour
After adding AEPCore SDk and running
pod install
, the app should build and run successfully on iOSActual Behaviour
During build phase, the following error causes the build to fail:
Use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modules
Reproduce Scenario (including but not limited to)
Create a new React Native app using Expo:
npx create-expo-app my-app
Install AEPCore SDK via npm:
npm install @adobe/react-native-aepcore
"Prebuild" to expose iOS folder:
expo prebuild --platform ios
Ensure pods installed via:
cd ios && pod install
Add imports to AppDelegate.h and implementation to AppDelegate
didFinishLaunchingWithOptions
per READMEBuild and run the project via
expo run:ios
or via XCodeBuild fails
Platform and Version
Issue occurs only for iOS. Android integration works as expected
Sample Code that illustrates the problem
Sample attached:
adobe-sample-expo-react-native.zip
The text was updated successfully, but these errors were encountered: