yandexmobile / react-native-appmetrica

React Native bridge to the AppMetrica on both iOS and Android.
MIT License
52 stars 132 forks source link

iOS build error #25

Closed airled closed 5 years ago

airled commented 5 years ago

Hi. I try to install library but face issues. As far as I see, it's not issue with react-native-appmetrica itself, but with original library. What I do:

Screen Shot 2019-06-20 at 02 24 25

When I run react-native run-ios I get this log:

▸ Compiling RCTAppMetrica.m

❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10:

could not build module 'Darwin'
                   ^~~~~~~~~

❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/dispatch/dispatch.h:25:10: could not build module 'Darwin'

#include <Availability.h>
 ~~~~~~~~^

❌  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/os/object.h:25:10: could not build module 'Darwin'

#include <Availability.h>
 ~~~~~~~~^

❌  /Users/airled/questquest_mobile/ios/build/questquest_mobile/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:8:9: could not build module 'Foundation'

#import <Foundation/Foundation.h>
 ~~~~~~~~^

❌  /Users/airled/questquest_mobile/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h:9:9: could not build module 'Foundation'

#import <Foundation/Foundation.h>
 ~~~~~~~^

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening questquest_mobile.xcworkspace

** BUILD FAILED **

The following build commands failed:
    CompileC /Users/airled/questquest_mobile/ios/build/questquest_mobile/Build/Intermediates.noindex/RCTAppMetrica.build/Debug-iphonesimulator/RCTAppMetrica.build/Objects-normal/x86_64/RCTAppMetrica.o /Users/airled/questquest_mobile/node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica/RCTAppMetrica.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Is there anything I miss? Dependencies:

"dependencies": {
    "@react-native-community/async-storage": "^1.3.4",
    "axios": "^0.18.0",
    "date-fns": "^1.30.1",
    "react": "16.8.3",
    "react-native": "0.59.5",
    "react-native-appmetrica": "^1.1.0",
    "react-native-elements": "^1.1.0",
    "react-native-firebase": "^5.4.2",
    "react-native-geolocation-service": "^2.0.1",
    "react-native-gesture-handler": "^1.1.0",
    "react-native-gifted-form": "^0.1.1",
    "react-native-maps": "^0.24.2",
    "react-native-modal": "^10.0.0",
    "react-native-phone-call": "^1.0.9",
    "react-native-reanimated": "^1.0.1",
    "react-native-tab-view": "^2.3.0",
    "react-native-vector-icons": "^6.4.2",
    "react-navigation": "^3.8.1",
    "striptags": "^3.1.1"
  },
  "devDependencies": {
    "@babel/core": "^7.4.3",
    "@babel/runtime": "^7.4.3",
    "babel-jest": "^24.7.1",
    "jest": "^24.7.1",
    "metro-react-native-babel-preset": "^0.53.1",
    "react-test-renderer": "16.8.3"
  }

Pods:

pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]
  pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
  pod 'react-native-maps', path: rn_maps_path
  pod 'react-native-google-maps', path: rn_maps_path  # Uncomment this line if you want to support GoogleMaps on iOS
  pod 'GoogleMaps'  # Uncomment this line if you want to support GoogleMaps on iOS
  pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
  pod 'Firebase/Core', '~> 5.20.1'
  pod 'GoogleIDFASupport'
  pod 'Firebase/Messaging'

Thanks

dkfl1995 commented 5 years ago

Please help with the same problem, I'd facing too... I cannot business app for a week because of this one!! What it can be?? I tried to fix this with hundreds of ways but no any of success. @doochik or anybody! RN: 0.59.5. (it also do not work on 0.57.x) YandexMetrica framework 3.5.0.

AnthonyAkentiev commented 5 years ago

@doochik Same with me.

AnthonyAkentiev commented 5 years ago

@dkfl1995 @airled I've fixed it by: 1) Open XCode 2) go to the RCTAppMetrica.xcodeproj project settings 3) Then click on RCTAppMetrica in the "Targets" (left panel) 4) Then go to "Build Settings" 5) Open "Search paths" 6) Fix "Header Search Paths" to Pods/Headers/Public directory

For example: Mine was $(PROJECT_DIR)/../../../../ios before

I've changed it to $(PROJECT_DIR)/../../../../ios/Pods/Headers/Public

And finally it worked

airled commented 5 years ago

@AnthonyAkentiev Works! Thank you so much! And I want to mention that fix above works if you install Appmetrica via pods (no need to copy whole lib to ios directory)