ARDcode/react-native-appmetrica-yandex

iOS setup not working

gwenoleR opened this issue ยท 9 comments

Hi guys !

I'm trying to use this package on my project but I have some issues..

I install the package using yarn :

yarn add react-native-appmetrica-yandex  

No problems.
I using RN v0.61.1, so I moved into my ios folder and launch pod install

cd ios
pod install

And no new package was install ๐Ÿ˜ž
The react native module was not detected.

This is the return of the detected modules during the pod install

Detected React Native module pods for BVLinearGradient, BugsnagReactNative, Picker, RNAudio, RNCAsyncStorage, RNCPushNotificationIOS, RNDeviceInfo, RNFBAnalytics, RNFBApp, RNFastImage, RNGestureHandler, RNIap, RNKeychain, RNLocalize, RNRate, RNReanimated, RNScreens, RNShare, RNSound, RNVectorIcons, lottie-ios, lottie-react-native, react-native-appsflyer, react-native-config, react-native-fbsdk, react-native-geocoder, react-native-geolocation, react-native-image-picker, react-native-location, react-native-mapbox-gl, react-native-netinfo, react-native-pdf, react-native-splash-screen, react-native-uuid-generator, react-native-video, and rn-fetch-blob

I'm said, "ok, nothing happen, but, let's try".

I wasn't suprised when the app crashed..

Here the error message:

TypeError: null is not an object (evaluating 'YandexAppmetrica.activateWithApiKey')

This error is located at:
    in App (at renderApplication.js:40)
    in RCTView (at AppContainer.js:101)
    in RCTView (at AppContainer.js:119)
    in AppContainer (at renderApplication.js:39)

YandexMetrica.activateWithApiKey
    index.js:9:25
App#setup
    app.tsx:129:37
App#constructor
    app.tsx:111:4
renderRoot
    [native code]:0
runRootCallback
    [native code]:0
unstable_runWithPriority
    scheduler.development.js:643:23
renderApplication
    renderApplication.js:52:52
runnables.appKey.run
    AppRegistry.js:116:10
runApplication
    AppRegistry.js:197:26
callFunctionReturnFlushedQueue
    [native code]:0

Any ideas of what I'm doing wrong ?

Thanks ! ๐Ÿ™‚

In the mean time you can use the old manual linking method

You aren't doing anything wrong, it's an issue with the package

I already tried the old manual linking method, but I can't add this package on my project because it used static libraries. ๐Ÿ˜ž

[!] The 'Pods-App' target has transitive dependencies that include statically linked binaries: 
([...]/ios/Pods/YandexMobileMetrica/static/YandexMobileMetrica.framework and [...]/ios/Pods/YandexMobileMetrica/static/YandexMobileMetricaCrashes.framework)

Here my Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'App' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  
  project 'App', 'Staging' => :release
  project 'App', 'Ad Hoc' => :release
  project 'App', 'Debug IAP' => :debug

  # Pods for App
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  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 'react-native-appmetrica-yandex', :path => '../node_modules/react-native-appmetrica-yandex'
  pod 'YandexMobileMetrica', '3.8.2'

  pod 'SinchRTC'

  use_native_modules!
end

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.start_with?('RNFB')
      puts "Overriding the static_framework? method for #{pod.name}"
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

Seems like this issue duplicates [#6]. There's a problem with autolink for iOS. I've looked to react-native config and ios param is set to null in the app dependencies config for react-native-appmetrica-yandex.
Possibly that's because xcode project files have been deleted from ios folder. Downgrade to 0.1.6 version, where xcode project still exists fixes react-native dependencies config. @ARDcode can you please check my conjecture and maybe commit xcode project files to repo?

@konclave thx, i'll check it soon

probably fixed in 0.4.4

0.4.4 fixed this issue. And #6 either. Thank you.

I confirm, 0.4.4 fixed this issue. Is it possible to add s.static_framework = true in the podspec ?
I can make a PR if you want

@gwenoleR np, ill add