Appcenter-sdk-react-native: Appcenter installation breaks ios build - 'React/RCTDefines.h' file not found

Created on 21 Jan 2019  路  38Comments  路  Source: microsoft/appcenter-sdk-react-native

Description

After installing appcenter by following all the steps in the documentation, android builds perfectly, but ios gives the following error:

In file included from ***(path to project root)***/node_modules/appcenter/ios/AppCenterReactNative/AppCenterReactNative.m:

'React/RCTDefines.h' file not found

Repro Steps

Please list the steps used to reproduce your issue.

  1. yarn add appcenter appcenter-analytics appcenter-crashes
  2. react-native link
  3. Fill in android and ios keys
  4. Installation completes successfully
  5. Clean build folder in Xcode (Cmd + Shift + K)
  6. Build in Xcode (Cmd + B)

Details

  1. Which version of the App Center SDK are you using?

    • 1.11.0

  2. Which OS version did you experience the issue on?

    • iOS 12

  3. What device version did you see this error on? Were you using an emulator or a physical device?

    • iPhone XR emulator

  4. What third party libraries are you using?
target '****' do
  pod 'AppCenter/Crashes', '~> 1.12.0'
  pod 'AppCenter/Analytics', '~> 1.12.0'
  pod 'AppCenterReactNativeShared', '~> 1.11.0'
  platform :ios, '9.0'
  use_frameworks!
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
      'Core',
      'CxxBridge',
      'RCTImage',
      'RCTNetwork',
      'RCTText',
      'RCTWebSocket',
      'DevSupport',
      'RCTAnimation',
      'RCTLinkingIOS'
  ]
  pod 'react-native-voximplant', path: '../node_modules/react-native-voximplant'
  pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'

  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'

  pod 'react-native-version-info', :path => '../node_modules/react-native-version-info'

  pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  # Pods for AppCenter


end
  1. Run the following command and paste the output below: react-native info
React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
      Memory: 524.35 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.11.0 - /usr/local/bin/node
      Yarn: 1.12.3 - ~/.yarn/bin/yarn
      npm: 6.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 27.0.3, 28.0.2, 28.0.3
        System Images: android-24 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5014246
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3 
      react-native: 0.57.8 => 0.57.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-rename: 2.4.0
  1. If you're developing for React Native iOS, run the following command and paste the output below: pod --version

1.5.3

support

Most helpful comment

So I believe i've figured out my issue. I have at least got the build succeeding. I think the issue lies in how the module is linked via the postlink script. In my particular case, I needed the modules to be added to my podfile like

pod 'appcenter', path: '../node_modules/appcenter/ios'
pod 'appcenter-analytics', path: '../node_modules/appcenter-analytics/ios'
pod 'appcenter-crashes', path: '../node_modules/appcenter-crashes/ios'
pod 'appcenter-push', path: '../node_modules/appcenter-push/ios'

Once the pods are installed, the AppDelegate file needed to be update to import the dependencies like

#import "AppCenterReactNative.h"
#import "AppCenterReactNativeAnalytics.h"
#import "AppCenterReactNativeCrashes.h"
#import "AppCenterReactNativePush.h"

and then used in the normal fashion

[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];  // Initialize AppCenter analytics
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];  // Initialize AppCenter crashes
[AppCenterReactNativePush register];

Since I ran the react-native link command, i hosed my project.pbxproj file (you don't want any AppCenter resource linked in here), so i had to remove all instances of the AppCenter references (or you could just revert this file back to the way it was prior to linking). The only new stuff added to this file is the AppCenter-Config.plist resource (which I added manually through xcode).

All 38 comments

Also wanted to note that running react-native link doesn't add dependencies below the # Pods for AppCenter comment, but always seems to insert the pods at the top of the file, right below target. It also tries to forcibly add platform :ios, '9.0' to the podfile, even if this has already been done at the top of the file, outside target

Hi @sanjaypojo and thank you for the request!

First of all, I see that there are a lot of extra linked pods in your podfile, which I assume cause the build to fail.
This is how a podfile for an empty app generated by react-native init looks like:

target 'RNApp' do
  pod 'AppCenter/Crashes', '~> 1.12.0'
  pod 'AppCenter/Analytics', '~> 1.12.0'
  pod 'AppCenterReactNativeShared', '~> 1.11.0'
  platform :ios, '9.0'
end

Unfortunately, I did not manage to reproduce your issue.
How did podfile look before linking AppCenter?
Did you deliberately add all these dependencies or they got linked by react-native link?
If the latter is true, try to delete both Podfiles + Pods folder, and run react-native link only on those modules that you need to link, in this case I'm assuming

react-native link appcenter
react-native link appcenter-analytics
react-native link appcenter-crashes

Please keep us updated on the issue.
Also, great suggestions on linking process, it definitely needs several improvements. Thanks for pointing to that!

Hi @annakocheshkova

All the pods are deliberately added (they鈥檙e part of a fully functional app that builds completely fine). The app build breaks when I add appcenter. If I remove appcenter, it builds fine again. I鈥檓 stuck and unable to integrate the appcenter SDK due to this issue.

The only lines added to my pod file when I do react-native link are the three lines associated with AppCenter. The error is also thrown in a line inside AppCenterReactNative.m

@sanjaypojo got it! Then could you paste here the output after running react-native link?

@sanjaypojo Still can not reproduce your issue. Here's what I did:

  1. Created ann app:
react-native init TestApp
cd TestApp
npm i react
npm i react-native
npm i react-native-permissions
npm i react-native-splash-screen
npm i react-native-version-info
npm i react-native-keep-awake
npm i react-native-device-info
npm i react-native-voximplant
  1. Created a pod file with the contents you provided but w\o AppCenter.
  2. Installed pods:
cd ios
pod install
  1. Built the project > Success
  2. Added AppCenter modules:
cd ..
yarn add appcenter appcenter-analytics appcenter-crashes
react-native link
  1. Clean > Build the project > Success.

Is there anything that I'm doing differently than in your project?

As an option (not the best one, unfortunately) I can suggest you follow the manual integration guide and see if it helps.

Thanks!

Hi @annakocheshkova, I still get errors when I do this. When you created the podfile, did you add use_frameworks to your podfile? Also, are you running react-native 0.57.2? Will integrate manually if you aren't able to reproduce my issue. Thanks for the help!

@sanjaypojo I tried with use_frameworks both commented out and not, so I guess it doesn't matter.
I have also tried with react-native 0.57.2 right now, but it still builds.

One thing I have to note though - with voximplant version from node_modules, I had my build fail with bitcode error (an issue completely unrelated to App Center but still), so I replaced it with the pod version: pod 'VoxImplantSDK'.
I know that it's a completely different issue but is there a chance these two are related? :)

Hi @sanjaypojo, how's the integration going? Do you have any updates?

@sanjaypojo I'm closing the issue for now, feel free to re-open if you have any further questions/updates!

I am also getting this same issue. I've followed the same steps as @sanjaypojo. Before adding any of the AppCenter Pods and linking application builds just fine.

React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 1.04 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.6 => 0.58.6
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library-full: 3.1.2
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7

Hi @M1K3Yio unfortunately, I have not been able to reproduce this issue.
Can you give me the exact steps you do or provide your package.json, maybe I will manage to reproduce it using your info.
As an option, you can try manual integration as well.
Thanks!

Hi @annakocheshkova

I followed the steps documented, npm install and react-link link added both secrets and enabled automatically. Android builds and runs fine. My steps where just like what @sanjaypojo described.

I have not tried the manual integration yet.

Here's our package.json

```{
"name": "documents",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start --port 8081",
"test": "jest"
},
"dependencies": {
"@babel/plugin-proposal-async-generator-functions": "7.2.0",
"@babel/plugin-proposal-class-properties": "7.3.4",
"@babel/plugin-proposal-decorators": "7.3.0",
"@babel/plugin-proposal-object-rest-spread": "7.3.4",
"@babel/plugin-transform-runtime": "7.3.4",
"@babel/runtime": "7.3.4",
"appcenter": "1.12.2",
"appcenter-analytics": "1.12.2",
"appcenter-crashes": "1.12.2",
"aws-amplify": "1.1.21",
"aws-amplify-react-native": "2.1.8",
"babel-plugin-module-resolver": "3.2.0",
"command-line-args": "5.0.2",
"decompress": "4.2.0",
"https-proxy-agent": "2.2.1",
"react": "16.6.3",
"react-native": "0.58.6",
"react-native-background-fetch": "2.5.1",
"react-native-background-task": "0.2.1",
"react-native-config": "0.11.7",
"react-native-picker-select": "6.0.0",
"react-native-push-notification": "3.1.2",
"react-native-queue": "1.2.1",
"react-native-touch-id": "4.4.1",
"react-native-vector-icons": "6.3.0",
"realm": "2.24.0"
},
"devDependencies": {
"babel-jest": "24.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.53.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}

Here's our `Podfile` with the AppCenter pod's

platform :ios, '10.0'

target 'mobile' do
pod 'AppCenter/Crashes', '~> 1.13.2'
pod 'AppCenter/Analytics', '~> 1.13.2'
pod 'AppCenterReactNativeShared', '~> 1.12.2'

pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTAnimation',
'RCTPushNotification',
'RCTLinkingIOS',
'RCTActionSheet',
'RCTBlob',
'RCTGeolocation',
'RCTImage',
'RCTSettings',
'RCTVibration'
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'TouchID', :path => '../node_modules/react-native-touch-id'
pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'RNAWSCognito', :path => '../node_modules/amazon-cognito-identity-js'
end

Error from `xcode`

Showing All Errors Only

Build target AppCenterReactNative of project AppCenterReactNative with configuration Debug

CompileC /Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/Objects-normal/arm64/AppCenterReactNative.o /_projects/XXX/XXXX/mobile/node_modules/appcenter/ios/AppCenterReactNative/AppCenterReactNative.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target: AppCenterReactNative)
cd /_projects/XXXX/XXXX/mobile/node_modules/appcenter/ios
export LANG=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/mjn39372/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/XXXXX/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -fembed-bitcode-marker -index-store-path /Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Index/DataStore -iquote /Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/AppCenterReactNative-generated-files.hmap -I/Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/AppCenterReactNative-own-target-headers.hmap -I/Users/XXXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/AppCenterReactNative-all-target-headers.hmap -iquote /Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/AppCenterReactNative-project-headers.hmap -I/Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Products/Debug-iphoneos/include -I/_projects/XXXXX/XXXXX/mobile/node_modules/react-native/React/Base -I/_projects/XXXXX/XXXXX/mobile/node_modules/react-native/React/Modules -I/_projects/XXXXX/XXXXX/mobile/node_modules/react-native/React/CSSLayout -I/_projects/XXXX/XXXX/mobile/node_modules/react-native/React/Views -I/Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/DerivedSources/arm64 -I/Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/DerivedSources -F/Users/XXXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Products/Debug-iphoneos -F/_projects/XXXX/XXXX/mobile/ios/Vendor -F../../../ios/Pods/AppCenter -F../../../ios/Pods/AppCenter/AppCenter-SDK-Apple -F../../../ios/Pods/AppCenter/AppCenter-SDK-Apple/iOS -F../../../ios/Pods/AppCenterReactNativeShared -F../../../ios/Pods/AppCenterReactNativeShared/AppCenterReactNativeShared -MMD -MT dependencies -MF /Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/Objects-normal/arm64/AppCenterReactNative.d --serialize-diagnostics /Users/XXXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/Objects-normal/arm64/AppCenterReactNative.dia -c /_projects/XXX/XXXX/mobile/node_modules/appcenter/ios/AppCenterReactNative/AppCenterReactNative.m -o /Users/XXXX/Library/Developer/Xcode/DerivedData/mobile-chaodphkbytwjhefsslzjhmiknwk/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphoneos/AppCenterReactNative.build/Objects-normal/arm64/AppCenterReactNative.o

In file included from /_projects/XXXXX/XXXX/mobile/node_modules/appcenter/ios/AppCenterReactNative/AppCenterReactNative.m:11:
/_projects/XXXX/XXXX/mobile/node_modules/react-native/React/Base/RCTAssert.h:10:9: fatal error: 'React/RCTDefines.h' file not found

import

    ^~~~~~~~~~~~~~~~~~~~

1 error generated.

```

Hi @M1K3Yio just tried to follow the steps I described earlier using your package.json but still can't reproduce :(
May there be some kind of conflict that is resolved by deleting node_modules and pods and re-installing everything?

@annakocheshkova I removed package.lock, node_modules, Podfile.lock, and Pods and still got the same error.

I also tried manual steps and getting this error.

In file included from /_projects/xxxxx/xxxxx/mobile/node_modules/appcenter-crashes/ios/AppCenterReactNativeCrashes/AppCenterReactNativeCrashesDelegate.m:2:
In file included from /_projects/xxxx/xxxxx/mobile/node_modules/appcenter-crashes/ios/AppCenterReactNativeCrashes/AppCenterReactNativeCrashesDelegate.h:8:
/_projects/xxxx/xxxx/mobile/node_modules/react-native/React/Modules/RCTEventEmitter.h:8:9: fatal error: 'React/RCTBridge.h' file not found
#import <React/RCTBridge.h>
        ^~~~~~~~~~~~~~~~~~~

@M1K3Yio what are you header search paths (_Your target > Build Settings > Header Search Paths_)?

i am experiencing the same issue. Without the the AppCenter pods, the app builds fine. When AppCenter is added, the build fails. I have a very similar podfile like the one listed above (with the react modules defined in the podfile). My header search paths are

HEADER_SEARCH_PATHS = (
                    "$(inherited)",
                    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
                    "$(SRCROOT)/../node_modules/react-native/React/**",
                    "$(SRCROOT)/../node_modules/appcenter/ios/AppCenterReactNative",
                    "$(SRCROOT)/../node_modules/appcenter-push/ios/AppCenterReactNativePush",
                );

Note: just trying to get push notification in the app right now

is there maybe a subspec missing from react? This is what I have in podfile

pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'DevSupport',
    'jschelpers',
    'cxxreact',
    'CxxBridge',
    'ART',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTCameraRoll',
    'RCTGeolocation',
    'RCTImage',
    'RCTNetwork',
    'RCTPushNotification',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'RCTLinkingIOS'
]

@gla5001 thanks I'll take a look, yeah this actually may be related to subspecs.
Can you also specify which header paths are recursive?

Thanks. I think the error is due do the react modules being defined in the podfile, but not entirely sure yet.

sure. the only one I have as recursive is $(SRCROOT)/../node_modules/react-native/React/**.

After refactoring my project to have react modules in the the podfile, I am running into this issue. It was working fine before when React Native was linked the standard way.

Here's my podfile:

target 'Chem101' do
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core',
  'CxxBridge',
  'DevSupport',
  'RCTText',
  'RCTImage',
  'RCTNetwork',
  'RCTWebSocket',
  'RCTSettings',
  'RCTAnimation',
  'RCTLinkingIOS',
  'RCTWebSocket',
  'RCTPushNotification'
  ]

  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'AppCenterReactNativeShared', '~> 1.12.2'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  platform :ios, '9.0'
  pod 'react-native-webview', :path => '../node_modules/react-native-webview'
  pod 'react-native-mixpanel', :path => '../node_modules/react-native-mixpanel'
  pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'
  pod 'RNSVG', :path => '../node_modules/react-native-svg'
end

My header search paths are:

HEADER_SEARCH_PATHS = (
    "$(inherited)/**",
    "${GENERATED_FILES_DIR}/**",
    "$(SRCROOT)/../node_modules/react-native-code-push/ios/**",
    "$(SRCROOT)/../node_modules/react-native/Libraries/**",
    "$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS/**",
    "$(SRCROOT)/../node_modules/appcenter/ios/**",
    "$(SRCROOT)/../node_modules/appcenter/ios/AppCenterReactNative/**",
);

I've tried several variations of recursive/non-recursive paths. React Native version 0.55.3.

@IgorBelyayev @gla5001 @M1K3Yio @sanjaypojo
So I just checked my subspecs and they do not differ significantly from the ones y'all have, so disregard that.
But just to make sure. Can somebody send me what targets their Pods project has and how they look like?

The solution I propose (based on my search paths that do not include React) is this comment.

Also, I highly recommend trying this comment (it seems to be solving the issue for a lot of people).

From my understanding, this issue in itself is not specific to AC, it appears with several other open-source packages, such as facebook etc. It's just that apparently in several cases (or in some configurations), App Center can't fetch RN subspecs and therefore does not work.
Since the issue is a known one, there are a lot of threads devoted to solving it, and as it's not specific to AC, they might help.

I'm looking through this threads now to try to offer you guys a good solution.
Please try the ones I suggested, I'm really curious what could cause this issue since I still can't reproduce. Really appreciate you trying to help.

I`ll re-open this as I see a lot of people facing the issue.

@annakocheshkova what version of cocoapods are you using?

@gla5001 Tried 1.6.1 and 1.5.3. Will double-check now.

@annakocheshkova which targets do you want?

None of the posted solutions work for me. @annakocheshkova you said you aren鈥檛 able to reproduce this issue. Are you able to push up your working app so I can fork/look at it and see what the difference is?

So I believe i've figured out my issue. I have at least got the build succeeding. I think the issue lies in how the module is linked via the postlink script. In my particular case, I needed the modules to be added to my podfile like

pod 'appcenter', path: '../node_modules/appcenter/ios'
pod 'appcenter-analytics', path: '../node_modules/appcenter-analytics/ios'
pod 'appcenter-crashes', path: '../node_modules/appcenter-crashes/ios'
pod 'appcenter-push', path: '../node_modules/appcenter-push/ios'

Once the pods are installed, the AppDelegate file needed to be update to import the dependencies like

#import "AppCenterReactNative.h"
#import "AppCenterReactNativeAnalytics.h"
#import "AppCenterReactNativeCrashes.h"
#import "AppCenterReactNativePush.h"

and then used in the normal fashion

[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];  // Initialize AppCenter analytics
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];  // Initialize AppCenter crashes
[AppCenterReactNativePush register];

Since I ran the react-native link command, i hosed my project.pbxproj file (you don't want any AppCenter resource linked in here), so i had to remove all instances of the AppCenter references (or you could just revert this file back to the way it was prior to linking). The only new stuff added to this file is the AppCenter-Config.plist resource (which I added manually through xcode).

@gla5001 I have an empty app, as I described in this comment.

Interesting solution - I wonder if this will work for all the others.
The last thing to figure out now is what is this particular case in which the common podfiile references don't work 馃槂
If we know when this happens, we can modify link script to reflect this case.
If any of you have a minimal working version I can reproduce on that'd be great!

I see. So the issue with creating an empty app like that with react-native init TestApp is that is it links the react native libraries in the project. In order for you to reproduce this issue, you need to remove all of those linkings (either in the project.pbxproj itself or in xcode). The only place the modules should be used is in the podfile. If you do that, I think you should be able to reproduce the issue (if you run the react-native link command to link AC).

So I think thats the root of this issue. When a project does not link the react libraries in the project and only uses the podfile for them.

@gla5001 thanks! I will try to reproduce this.

Hi @annakocheshkova, I'm facing the same issue when creating an Expo bare workflow app. The steps to reproduce what is being found above are quite simple so I thought it may be of help to you:

If you don't have expo-cli yet, get it:
npm i -g expo-cli

If you don't have react-native-cli yet, get it:
npm i -g react-native-cli

Init your new app:
expo init --template bare-minimum

Intall pods:
cd newProjectName && cd ios && pod install

Open the project in Xcode and run it on a simulator, note it works.

Before installing App Center, add NSURL *jsCodeLocation; to your AppDelegate.m above the line that starts with RCTBridge....

Install App Center by following the docs. On the first linking attempt you will get an error because App Center adds the platform :ios, '9.0' line, you'll need to change that to platform :ios, '10.0' and link again.

Try to run the app from Xcode and you will see the 'React/RCTDefines.h' file not found error.

Hi everyone. We decided to document the scenario you described with the solution provided by @gla5001 so that others having this issue would know how to solve it. We definitely want to provide better experience for the users, but decided to keep the more common and standart way of linking pods in our linking script.

I will post updates on the documentation in #556 and close this one.

@AnastasiaKubova The solution provided by @gla5001 did not work for me.

@IgorBelyayev close, but not her 馃槄

Could you try integrating from the start, folllowing the steps from official App Center documentation?

@IgorBelyayev If the steps pointed out in https://github.com/microsoft/appcenter-sdk-react-native/issues/510#issuecomment-492542298 don't work for you, please create a new issue with details and using our issue template.

I'm not really an expert on ios development, i encountered this issue after trying to integrate react native code push following the outlined procedures.

I however was able to get a successful build after i removed the "libAppCenterReactNative.a, libAppCenterReactNativeAnalytics.a, libAppCenterReactNativeCrashes.a and libAppCenterReactNativePush.a" Link Binary With Libraries in the Build Phases of my proj.xcworkspace as it was was already added and installed via my pod file. Apparently react-native link adds pod entry and also links as though it was an xcodeproj which shouldn't be the case.

Hi, I encountered this issue when trying to integrate Appcenter for ios and I followed the steps of this article after struggling for many hours and it fixed the issue . Hope this helps someone !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

divyamakkar26 picture divyamakkar26  路  7Comments

MrLoh picture MrLoh  路  4Comments

rafaelcorreiapoli picture rafaelcorreiapoli  路  5Comments

aprilmintacpineda picture aprilmintacpineda  路  5Comments

elnygren picture elnygren  路  5Comments