Skip to content
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

iOS Build fails with "AppCenter/AppCenter.h" file not found #420

Closed
milesmatthias opened this issue Sep 10, 2018 · 34 comments
Closed

iOS Build fails with "AppCenter/AppCenter.h" file not found #420

milesmatthias opened this issue Sep 10, 2018 · 34 comments
Labels

Comments

@milesmatthias
Copy link

Description

Running a project after adding AppCenter to an XCode workspace fails. 3 App Center projects are added to my Xcode workspace: AppCenterReactNative, AppCenterReactNativeAnalytics, and AppCenterReactNativeCrashes, all 3 of which try to import AppCenter/AppCenter.h and they're all failing to find the file.

Repro Steps

Please list the steps used to reproduce your issue.

  1. npm install appcenter appcenter-analytics appcenter-crashes --save
  2. react-native link
  3. Run iOS workspace, either through Xcode or react-native run-ios

Details

  1. Which SDK version are you using?
    • 1.5.1
  2. Which OS version did you experience the issue on?
    • iOS 11
  3. What device version did you see this error on? Were you using an emulator or a physical device?
    • iPhone X emulator
  4. What third party libraries are you using?
    • None
  5. Run the following command and paste the output below: react-native info
Environment:
  OS: macOS High Sierra 10.13.6
  Node: 8.9.4
  Yarn: Not Found
  npm: 5.6.0
  Watchman: 4.9.0
  Xcode: Xcode 9.4.1 Build version 9F2000
  Android Studio: 3.1 AI-173.4819257

Packages: (wanted => installed)
  react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
  react-native: ^0.54.4 => 0.54.4
  1. If you're developing for React Native iOS, run the following command and paste the output below: pod --version

1.5.0

  1. Please enable verbose logging for your app using [MSAppCenter setLogLevel: MSLogLevelVerbose]; before your call to [AppCenterReactNative register]; (or any other SDK registration). For Android, use AppCenter.setLogLevel(android.util.Log.VERBOSE); before your SoLoader.init call. Include the logs here:
@milesmatthias
Copy link
Author

To answer @guperrot's questions, yes I'm opening xcworkspace and yes, running the app gives the same build error (missing AppCenter.h)

@jaeklim
Copy link
Contributor

jaeklim commented Sep 10, 2018

@milesmatthias Thanks for creating a new issue.
Can you see AppCenter.framework under Pods when you open your workspace in Xcode?
Can you also check if AppCenterReactNative (and the other projects, too) has framework search paths that is set to ios/Pods/AppCenter?

@milesmatthias
Copy link
Author

Spent more time debugging this today. I'm not sure if it's some weird edge case with my setup, or if it's edge cases with npm & react-native, but here are the two roads:

  1. Use npm install appcenter... and react-native link. npm install appcenter... actually removes 3 packages of mine, so xcode complains that those libraries are now gone, so I have to do a npm i in order to re-add them. Then react-native link hoses some other packages, so now I'm seeing a totally different error.

  2. Manually install and link the packages. This is usually how I install new packages, for the above experiences. Unfortunately, your docs only have manual instructions for projects not using Cocoapods. I am using Cocoapods, so it'd be great to see manual instructions using Cocoapods. It'd also be great to include manual installation instructions for Android, like most RN projects do, see example.

@bmourat
Copy link
Contributor

bmourat commented Sep 11, 2018

Hi @milesmatthias

I'have some questions:

  1. Are you saying that running npm install appcenter... actually removes somes packages from your project?
  2. Are you using react as a Pod?
  3. Is there any reason why you prefer to link manually instead if using react-native link?
  4. Could you also provide answers to this comment.

Best,
Murat

@milesmatthias
Copy link
Author

milesmatthias commented Sep 11, 2018

  1. Yes. I have 3 packages that disappear after running any npm install <package> --save command.
  2. Yes
  3. react-native link adds duplicate Android include lines for me, and it usually unlinks a few projects (but maybe that behavior is because after running npm install <package> --save, packages it's trying to link are missing.
  4. Yes, I see AppCenter.framework under pods in xcode, but no, there aren't any Framework Search paths under the AppCenter projects in my workspace. That field is simply blank for all AppCenter projects.

Thanks for your help with this by the way!

@jaeklim
Copy link
Contributor

jaeklim commented Sep 11, 2018

@milesmatthias Thanks for the answers.
Please make sure you check framework search paths for a target, not for a project.
Manually setting the paths would fix the issue. Can you try and see if that works?
image

@milesmatthias
Copy link
Author

Thanks for that clarification @jaelim-ms, I was looking at the projects, not the targets. The targets do have these Framework search paths in them.

@jaeklim
Copy link
Contributor

jaeklim commented Sep 11, 2018

@milesmatthias Can you tell me how you created your project initially? Did you run react-native init to create a project? Can you also check the Framework Search Paths that have valid paths to reference to frameworks?

@jaeklim
Copy link
Contributor

jaeklim commented Sep 13, 2018

@mmiani If I understand correctly, your PR fixes React dependency issue. The issue that @milesmatthias is facing is a dependency for App Center SDK.

@dhei
Copy link
Member

dhei commented Sep 19, 2018

Hi @milesmatthias,
Do you still have the issue? We haven't heard back from you for a while, I'm closing this issue now but you can reopen with answers anytime you want. Thanks!

@dhei dhei closed this as completed Sep 19, 2018
@felix-weizman-deel
Copy link

I have the same issue here, it works in Xcode(debug and release), but in app-center build I get same errors:

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/App-fsvoacyptuturlgeiqjkzbuzusqj/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/AppCenterReactNativeCrashes.build/Release-iphoneos/AppCenterReactNativeCrashes.build/Objects-normal/armv7/AppCenterReactNativeCrashesDelegate.o AppCenterReactNativeCrashes/AppCenterReactNativeCrashesDelegate.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/vsts/agent/2.140.0/work/1/s/node_modules/appcenter-crashes/ios
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode_9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode_9.4.1.app/Contents/Developer/usr/bin:/Library/Frameworks/Mono.framework/Versions/4/bin:/usr/local/bin:/usr/local/sbin:/Users/vsts/bin:/Users/vsts/.yarn/bin:/usr/local/go/bin:/Users/vsts/Library/Android/sdk/tools:/Users/vsts/Library/Android/sdk/platform-tools:/Users/vsts/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vsts/.azcopy"
/Applications/Xcode_9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/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 -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -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-param...
/Users/vsts/agent/2.140.0/work/1/s/node_modules/appcenter-crashes/ios/AppCenterReactNativeCrashes/AppCenterReactNativeCrashesDelegate.m:1:9: fatal error: 'AppCenterCrashes/AppCenterCrashes.h' file not found
#import <AppCenterCrashes/AppCenterCrashes.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/App-fsvoacyptuturlgeiqjkzbuzusqj/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/AppCenterReactNativeCrashes.build/Release-iphoneos/AppCenterReactNativeCrashes.build/Objects-normal/armv7/AppCenterReactNativeCrashesUtils.o AppCenterReactNativeCrashes/AppCenterReactNativeCrashesUtils.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/vsts/agent/2.140.0/work/1/s/node_modules/appcenter-crashes/ios
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode_9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode_9.4.1.app/Contents/Developer/usr/bin:/Library/Frameworks/Mono.framework/Versions/4/bin:/usr/local/bin:/usr/local/sbin:/Users/vsts/bin:/Users/vsts/.yarn/bin:/usr/local/go/bin:/Users/vsts/Library/Android/sdk/tools:/Users/vsts/Library/Android/sdk/platform-tools:/Users/vsts/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vsts/.azcopy"
/Applications/Xcode_9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/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 -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -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-param...
/Users/vsts/agent/2.140.0/work/1/s/node_modules/appcenter-crashes/ios/AppCenterReactNativeCrashes/AppCenterReactNativeCrashesUtils.m:3:9: fatal error: 'AppCenterCrashes/MSErrorReport.h' file not found
#import <AppCenterCrashes/MSErrorReport.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/App-fsvoacyptuturlgeiqjkzbuzusqj/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/AppCenterReactNativeCrashes.build/Release-iphoneos/AppCenterReactNativeCrashes.build/Objects-normal/armv7/AppCenterReactNativeCrashes.o AppCenterReactNativeCrashes/AppCenterReactNativeCrashes.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/vsts/agent/2.140.0/work/1/s/node_modules/appcenter-crashes/ios
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode_9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode_9.4.1.app/Contents/Developer/usr/bin:/Library/Frameworks/Mono.framework/Versions/4/bin:/usr/local/bin:/usr/local/sbin:/Users/vsts/bin:/Users/vsts/.yarn/bin:/usr/local/go/bin:/Users/vsts/Library/Android/sdk/tools:/Users/vsts/Library/Android/sdk/platform-tools:/Users/vsts/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vsts/.azcopy"
/Applications/Xcode_9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/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 -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -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-param...

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/App-fsvoacyptuturlgeiqjkzbuzusqj/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/AppCenterReactNativeCrashes.build/Release-iphoneos/AppCenterReactNativeCrashes.build/Objects-normal/arm64/AppCenterReactNativeCrashesDelegate.o AppCenterReactNativeCrashes/AppCenterReactNativeCrashesDelegate.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/vsts/agent/2.140.0/work/1/s/node_modules/appcenter-crashes/ios
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode_9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode_9.4.1.app/Contents/Developer/usr/bin:/Library/Frameworks/Mono.framework/Versions/4/bin:/usr/local/bin:/usr/local/sbin:/Users/vsts/bin:/Users/vsts/.yarn/bin:/usr/local/go/bin:/Users/vsts/Library/Android/sdk/tools:/Users/vsts/Library/Android/sdk/platform-tools:/Users/vsts/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vsts/.azcopy"
/Applications/Xcode_9.4.1.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/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/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 -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -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-param...
/Users/vsts/agent/2.140.0/work/1/s/node_modules/appcenter-crashes/ios/AppCenterReactNativeCrashes/AppCenterReactNativeCrashesDelegate.m:1:9: fatal error: 'AppCenterCrashes/AppCenterCrashes.h' file not found
#import <AppCenterCrashes/AppCenterCrashes.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

** ARCHIVE FAILED **

The following build commands failed:
CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/App-fsvoacyptuturlgeiqjkzbuzusqj/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/AppCenterReactNativeCrashes.build/Release-iphoneos/AppCenterReactNativeCrashes.build/Objects-normal/armv7/AppCenterReactNativeCrashesUtils.o AppCenterReactNativeCrashes/AppCenterReactNativeCrashesUtils.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65

@thyeggman
Copy link
Contributor

@felix-zg Could you open a new issue and include all the information in the template? Otherwise it's difficult for us to test your exact scenario.

@ospfranco
Copy link

ospfranco commented Oct 9, 2018

Hello, I created a brand new project via react-native init that gave me a brand new project with react-native version: 0.57, then ran:

yarn install appcenter appcenter-analytics appcenter-crashes

followed by

react-native link

Added the keys I had from appcenter.ms but when I tried to run it, compilation fails saying appcenter.h is missing and I can see on recovered references the libraries are marked as red.

Seems like a major bug when the installation instructions on a brand new project don't seem to work...

Just realized I'm missing cocoapods, you might want to add that into the set up instructions you have when you create a new app on appcenter.ms

@iamclement
Copy link
Contributor

Hi @ospfranco,
Thanks for reporting your documentation concerns. Can you elaborate a little about what you are expecting from the documentation? Is this about the missing pod repo update?
Thanks.

@wildseansy
Copy link

re-running pod install (pods were already installed) fixed this for me.

@ospfranco
Copy link

ospfranco commented Dec 17, 2018

now I'm facing the same issue as felix-zg on a brand new project with a "staging" target, I checked the framework search paths and made sure pods are installed, but still no luck

screenshot 2018-12-17 at 12 14 28

@ospfranco
Copy link

I was missing to change the per build configuration path, not on the target but on the project.

screenshot 2018-12-17 at 12 47 40

However I have one more issue, I have to delete the libPods.a linked library for staging target to compile.

@emielvanliere
Copy link

emielvanliere commented Feb 5, 2019

I also ran into this error on App Center Build while locally it worked fine. Fixed it by adding these lines to my appcenter-pre-build.sh script:

printf "\nInstalling Pods...\n"
cd ios
pod install --repo-update
cd ..
printf "\nFinished installing Pods.\n"

Love to hear if there's a better solution.

@nihar108
Copy link

nihar108 commented Feb 21, 2019

I followed this document and faced the same issue.

Fixed it by adding the path of the folder where Appcenter.framework, AppCenterCrashes.framework and other frameworks are present, to the Framework Search Paths of the AppCenterReactNative.xcodeproj, AppCenterReactNativeCrashes.xcodeproj and other included modules.

I have put all the downloaded frameworks inside rn-app/ios/Frameworks/AppCenter.

So I added $(SRCROOT)/../../../ios/Frameworks/AppCenter to the Framework Search Paths of the xcodeproj libraries included from the node_modules (since the path of the libraries is like rn-app/node_modules/appcenter/ios/AppCenterReactNative.xcodeproj).

Make sure you have selected the xcodeproj libraries as target and not your own main app.

@duytq94
Copy link

duytq94 commented Mar 19, 2019

Hi, for this error, follow main instructions and in my case, I put these code at the top of Podfile

pod 'AppCenter/Crashes', '~> 1.12.0'
pod 'AppCenterReactNativeShared', '~> 1.11.0'
pod 'AppCenter/Analytics', '~> 1.12.0'

and run pod install again, then it works.
Seem Microsoft doesn't mention about config at the podfile in their document.

@iamclement
Copy link
Contributor

@duytq94 the podfile is supposed to be updated by the react-native link. (From the AppCenter documentation)

@duytq94
Copy link

duytq94 commented Mar 20, 2019

@clpolet seem it doesn't add them, at least in my case.

@guperrot
Copy link
Member

@duytq94 please file a separate issue with all the necessary details from the issue template so we can reproduce the issue and fix it.

@omatrot
Copy link

omatrot commented Apr 2, 2019

I had this problem when installing the SDK manually following the instructions in the documentation.
So to be clear, I am using neither Cocoa Pos nor react-native link.
I followed the instructions carefully.
In point 7. I've dragged the project as explained coming from the downloaded SDK. But I missed to create a Vendor directory.
This is important because the projects coming from the SDKs have pre defined user header search paths like the following:

$(SRCROOT)/../../../ios/Vendor
$(SRCROOT)/../../../ios/Pods/AppCenter
$(SRCROOT)/../../../ios/Pods/AppCenterReactNativeShared

So If you put the frameworks outside the directories shown above (like I did at first), your project won't compile.

@yonghongren
Copy link

yonghongren commented Apr 20, 2019

I had the same error but it was not caused by any of the above scenarios. FRAMEWORK_SEARCH_PATH is automatically configured properly by "react-native link":

+             FRAMEWORK_SEARCH_PATHS = (
+                   "$(inherited)",
+                   "\"${PODS_ROOT}/AppCenter/AppCenter-SDK-Apple/iOS\"",
+                   "\"${PODS_ROOT}/AppCenterReactNativeShared/AppCenterReactNativeShared\"",
+               );

But if "FRAMEWORK_SEARCH_PATHS[arch=*]" is configured, the linker won't use FRAMEWORK_SEARCH_PATH, causing the failure. The solution is consolidate "FRAMEWORK_SEARCH_PATHS[arch=*]" into FRAMEWORK_SEARCH_PATH and use FRAMEWORK_SEARCH_PATH only.

@aruntummala
Copy link

If someone still seeing the #import <AppCenterReactNativeCrashes/AppCenterReactNativeCrashes.h>
file not found - I followed the steps here https://docs.microsoft.com/en-us/appcenter/sdk/troubleshooting/react-native#reactrctdefinesh-file-not-found

Added pods

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'

And changed
#import <AppCenterReactNative/AppCenterReactNative.h> #import <AppCenterReactNativeAnalytics/AppCenterReactNativeAnalytics.h> #import <AppCenterReactNativeCrashes/AppCenterReactNativeCrashes.h> #import <AppCenterReactNativePush/AppCenterReactNativePush.h>

to

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

@thingtechbuilder
Copy link

Instructions as Written Are Incorrect

I cannot get this work. Any of these things.
I did the npm install and react-native link and double-checked the location of the pods and the search path. No matter what I do, I still get

/usr/local/lib/node_modules/appcenter/ios/AppCenterReactNative/AppCenterReactNative.m:22:9:
 'AppCenter/AppCenter.h' file not found

Question: None of my other (many) RN modules have a presence in /usr/local/lib/node_modules. What is that necessary?

I undid everything so that git status was clean. Then I repeated the process with a slight change.

This is What Finally Worked

npm install appcenter appcenter-analytics appcenter-crashes --save

Note that it is --save and not --save-exact. This appears to be the key.

I ran react-native link which yields two things: first, react-native link without a package name will be depreciated. Second, is this message:

Could not configure AppCenter for iOS. Error Reason - 
        Error: Could not find a "# Pods for" comment in your Podfile. Please add a "# Pods for AppCenter" line
        in ./ios/Podfile, inside
        the "target" section, then rerun the react-native link. AppCenter pods will be added below the comment.

Consequently my Podfile was never updated. I added that comment and re-ran react-native link. I think this step is missing in your instructions. BUT, this happened to me the first time as well, and it still did not build.

running react-native link has always been a bit dicey for me as it can mess up android configurations, but I threw caution to the wind for this.

I then ran pod update in the ios directory.

I started Metro Builder using react-native start --resetCache just to be sure things were empty.

I ran react-native run-ios which built quickly and ran my app. I checked my app's Analytics page and there it was.

I hope this helps others.

@dhei dhei reopened this Jun 28, 2019
@dhei
Copy link
Member

dhei commented Jul 2, 2019

Hi @thingtechbuilder,

Thanks for you sharing.

I wonder why only --save worked for you but not --save-exact. The only difference between them is --save-exact saves dependencies with an exact version rather than using npm’s default semver range operator, which is unrelated to the build issue you may have.

npm install appcenter appcenter-analytics appcenter-crashes --save
Note that it is --save and not --save-exact. This appears to be the key.

We will update our docs to use react-native link {package} instead of react-native link as linking without a package name is being deprecated.

@dhei dhei closed this as completed Jul 8, 2019
@alitsvin
Copy link

I have the same issue but none of solutions above didn't help. I've updated versions of appcenter and its services and cleared xcode project cache so it started to work.
So the issue was appcenter crashes changed class names in new version on the library and they didn't match somewhere and import tried to resolve file with old name.

@russelarms
Copy link
Contributor

@alitsvin it is fixed in patch version 3.1.3 or in the next release of version 4+. At the moment for version 4, a general clean should resolve these troubles.
Related PRs:
#879
#877

@jpmc3630
Copy link

npm install appcenter appcenter-analytics appcenter-crashes --save

and appcenter-core in pod file did it for me

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

@DmitriyKirakosyan
Copy link
Contributor

Hi @jpmc3630

Could you elaborate a bit on that? Did you have this issue and then fixed it using the approach in your comment?
What version of appcenter sdk are you using?

@jpmc3630
Copy link

Hi @DmitriyKirakosyan

Yeah I had this issue, and tried more or less everything on this page.

I'm using a version of RN that started <6.0 and is now 6.3 but I suspect something was missed when it was migrated/updated, because nothing seems to link properly - auto or when running react-native link.

Running react-native link didn't throw any errors, but did nothing.

When I added to the podfile:

pod 'appcenter', path: '../node_modules/appcenter/ios' 

as suggested by others here, I got error 'No podspec found in node_modules/appcenter/ios'

So I had a look and the podspec is called appcenter-core.podspec. So I suffixed it with -core and immediately saw the data hit the Analytics page of Appcenter, so presumed that's working correctly.

The versions I'm running are:

    "appcenter": "^4.2.0",
    "appcenter-analytics": "^4.2.0",
    "appcenter-crashes": "^4.2.0",

@DmitriyKirakosyan
Copy link
Contributor

Thank you for sharing the details! Glad it worked for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests