mParticle / mparticle-apple-sdk

mParticle Apple SDK
Apache License 2.0
45 stars 66 forks source link

'Swift.h' file not found #265

Closed dylmye closed 5 months ago

dylmye commented 5 months ago

I'm trying to configure react-native-mparticle (well actually I'm trying to make an Expo plugin for the React Native package) and following the instructions to install mParticle-Apple-SDK using use_frameworks with the dynamic linkage style. The closest I can do to that is set use_frameworks! :linkage => :dynamic. When I don't set that, I get #198 . When I do set it, I get this:

› Planning build
› Executing react-native Pods/hermes-engine » [CP-User] [Hermes] Replace Hermes for the right configuration, if needed
› Linking   react-native Pods/React-perflogger » reactperflogger
› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPResponseEvents.m
› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPTransactionAttributes.m

❌  (ios/Pods/mParticle-Apple-SDK/mParticle-Apple-SDK/Ecommerce/MPTransactionAttributes.m:2:9)

  1 | #import "MPTransactionAttributes.h"
> 2 | #import "Swift.h"
    |         ^ 'Swift.h' file not found
  3 | #import "NSDictionary+MPCaseInsensitive.h"
  4 | #import "MPILogger.h"
  5 | #import "mParticle.h"

› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPSurrogateAppDelegate.m
› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPStateMachine.m

❌  (ios/Pods/mParticle-Apple-SDK/mParticle-Apple-SDK/Utils/MPStateMachine.m:21:9)

  19 | #import "MPForwardQueueParameters.h"
  20 | #import "MPDataPlanFilter.h"
> 21 | #import "Swift.h"
     |         ^ 'Swift.h' file not found
  22 | 
  23 | #if TARGET_OS_IOS == 1
  24 | #ifndef MPARTICLE_LOCATION_DISABLE

› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPSession.m
› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPSearchAdsAttribution.m
› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPResponseConfig.m
› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPPromotion.m

❌  (ios/Pods/mParticle-Apple-SDK/mParticle-Apple-SDK/Ecommerce/MPPromotion.m:4:9)

  2 | #import "MPIConstants.h"
  3 | #import "NSDictionary+MPCaseInsensitive.h"
> 4 | #import "Swift.h"
    |         ^ 'Swift.h' file not found
  5 | 
  6 | // Internal keys
  7 | NSString *const kMPPMAction = @"an";

› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPProduct.m

❌  (ios/Pods/mParticle-Apple-SDK/mParticle-Apple-SDK/Ecommerce/MPProduct.m:2:9)

  1 | #import "MPProduct.h"
> 2 | #import "Swift.h"
    |         ^ 'Swift.h' file not found
  3 | #import "MPIConstants.h"
  4 | #import "NSDictionary+MPCaseInsensitive.h"
  5 | #import "MPILogger.h"

› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPPersistenceController.mm
› Compiling @dylmye/config-plugin-react-native-mparticle Pods/mParticle-Apple-SDK » MPNotificationController.m

› 4 error(s), and 0 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.
error Command failed with exit code 1.

What's weird is I can see the Swift.h file! Any ideas on what I need to configure here - something search paths related? I'm not super well versed in Swift code but I'm happy to share my code if interested.

image

Thanks in advance.

BrandonStalnaker commented 5 months ago

@dylmye My recent discovery might help you here. The pre install command here will have cocoapods include us and only us as a dynamic framework. https://github.com/mParticle/react-native-mparticle/pull/204/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5

dylmye commented 5 months ago

Just back from holiday today, looking into this. Thanks for sharing.

dylmye commented 5 months ago

Fixed by implementing the pre_install hook, thanks