react-native-fbads icon indicating copy to clipboard operation
react-native-fbads copied to clipboard

[7.0.5] Error: "no known class method" while compiling library

Open kkusanagi opened this issue 4 years ago • 17 comments

Error as below /Users/kyokurosagi/ReactNative/tootitoo/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m:90:17: error: no known class method for selector 'setMixedAudience:' [FBAdSettings setMixedAudience:isDirected]; ^~~~~~~~~~~~~~~~ /Users/kyokurosagi/ReactNative/tootitoo/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m:135:19: error: no known class method for selector 'setAdvertiserTrackingEnabled:' [FBAdSettings setAdvertiserTrackingEnabled:enabled]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/kyokurosagi/ReactNative/tootitoo/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m:141:17: error: no known class method for selector 'setMixedAudience:' [FBAdSettings setMixedAudience:_isChildDirected]; ^~~~~~~~~~~~~~~~ /Users/kyokurosagi/ReactNative/tootitoo/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m:150:17: error: no known class method for selector 'setMixedAudience:' [FBAdSettings setMixedAudience:NO]; ^~~~~~~~~~~~~~~~ 4 errors generated.

Upgrading from 6.3.1 to 7.0.5. Had run cd ios && pod install. Is it only me getting this error?

using react 16.13.1 react-native 0.63.3 Deployment Target is version 9.0

kkusanagi avatar Apr 11 '21 14:04 kkusanagi

Please share a link to repo where we can easily reproduce this bug ;). Please remove Pods folder inside ios directoryand then run pod install` again.

TMaszko avatar Apr 11 '21 18:04 TMaszko

Had remove Pods folder and pod install again. Still same Here is my pod files data.

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'tootitoo' do
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])
  
  # Permission
  permissions_path = '../node_modules/react-native-permissions/ios'

  # pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  # pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
  # pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  # pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  # pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
  # pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
  # pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
  # pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
  # pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"

  pod 'FBSDKCoreKit', '5.8.0'
  pod 'FBSDKLoginKit', '5.8.0'
  pod 'FBSDKShareKit', '5.8.0'

  pod 'FBAudienceNetwork', '~> 5.1.0'

  pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  
  # pod 'Fabric', '~> 1.10.2'
  # pod 'Crashlytics', '~> 3.13.2'

  pod 'react-native-twitter-signin', :path => '../node_modules/react-native-twitter-signin'

  pod 'TwitterKit', '~> 3.3.0'


  pod 'RNLocalize', :path => '../node_modules/react-native-localize'


  pod 'ReactNativeAdsFacebook', :path => '../node_modules/react-native-fbads'

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

  target 'tootitooTests' do
    inherit! :complete
    # Pods for testing
  end

  use_native_modules!

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'tootitoo-tvOS' do
  # Pods for tootitoo-tvOS

  target 'tootitoo-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

kkusanagi avatar Apr 11 '21 20:04 kkusanagi

Try removing pod 'FBAudienceNetwork', '~> 5.1.0' line because our library already has it as a dependency and versions don't match ( lib uses version 6). Additionally you can remove manual link from pod file because autolinking feature will do the job for you ;)

TMaszko avatar Apr 12 '21 20:04 TMaszko

Now left one error after remove pod 'FBAudienceNetwork', '~> 5.1.0'

result when pod install

Installing FBAudienceNetwork 5.10.1 (was 5.1.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing ReactNativeAdsFacebook 7.0.5 (was 6.3.1)

Error when compiling

/Users/kyokurosagi/ReactNative/tootitoo/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m:135:19: error: no known class method for selector 'setAdvertiserTrackingEnabled:'
    [FBAdSettings setAdvertiserTrackingEnabled:enabled];
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

kkusanagi avatar Apr 13 '21 08:04 kkusanagi

You should also remove following hardcoded dependencies:

  • pod 'FBSDKCoreKit', '5.8.0'
  • pod 'FBSDKLoginKit', '5.8.0'
  • pod 'FBSDKShareKit', '5.8.0' See our example https://github.com/callstack/react-native-fbads/tree/master/example and check Podfile for the further reference :).

TMaszko avatar Apr 13 '21 09:04 TMaszko

Shouldn't this is for react-native-fbsdk? It should have no connection to react-native-fbads.

I'm using react-native-fbsdk for facebook login. So it can't be removed for current sdk version.

kkusanagi avatar Apr 13 '21 09:04 kkusanagi

Which version of the react-native-fbsdk are you using? If u remove hardcoded dependencies from pod file they will be autolinked by react native cli and added to the project. You still should be able to use them.

TMaszko avatar Apr 13 '21 09:04 TMaszko

had upgrade to latest version react-native-fbsdk-next and remove 'FBSDKCoreKit' 'FBSDKLoginKit' 'FBSDKShareKit' still same 1 error as stated above

kkusanagi avatar Apr 13 '21 15:04 kkusanagi

Please, look at our example app and check if u have the same react-native-fbsdk version :)

TMaszko avatar Apr 13 '21 22:04 TMaszko

Had follow react-native-fbsdk 3.0.0. still same 1 error as above.

You should also remove following hardcoded dependencies:

  • pod 'FBSDKCoreKit', '5.8.0'
  • pod 'FBSDKLoginKit', '5.8.0'
  • pod 'FBSDKShareKit', '5.8.0' See our example https://github.com/callstack/react-native-fbads/tree/master/example and check Podfile for the further reference :).

had remove all aboved. Still same error.

Installing FBSDKCoreKit 8.2.0 (was 9.0.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FBSDKLoginKit 8.2.0 (was 9.0.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FBSDKShareKit 8.2.0 (was 9.0.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing react-native-fbsdk (3.0.0)

kkusanagi avatar Apr 14 '21 04:04 kkusanagi

Could you please share a repo where we could easily reproduce this bug ;)?

TMaszko avatar Apr 14 '21 08:04 TMaszko

Could you please share a repo where we could easily reproduce this bug ;)?

Actually i don't know how to share a repo. Do you mean the compilation result? Or pod file and package.json?

kkusanagi avatar Apr 14 '21 08:04 kkusanagi

Push your project to the github and share a link. It must be a public repo :)

TMaszko avatar Apr 14 '21 08:04 TMaszko

report.txt

and my package.json

{
  "name": "tootitoo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@invertase/react-native-apple-authentication": "^1.0.0",
    "@react-native-community/async-storage": "^1.8.1",
    "@react-native-community/clipboard": "^1.2.1",
    "@react-native-community/datetimepicker": "^3.4.3",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/masked-view": "^0.1.7",
    "@react-native-community/picker": "^1.8.1",
    "@react-native-community/push-notification-ios": "^1.8.0",
    "@react-native-firebase/analytics": "^7.4.2",
    "@react-native-firebase/app": "^8.3.1",
    "@react-native-firebase/auth": "^9.0.0",
    "@react-native-firebase/crashlytics": "^8.3.4",
    "@react-native-firebase/dynamic-links": "^7.4.3",
    "@react-native-firebase/firestore": "^7.5.3",
    "@react-native-firebase/functions": "^7.3.2",
    "@react-native-firebase/messaging": "^7.7.3",
    "@react-native-firebase/storage": "^7.3.3",
    "@react-navigation/bottom-tabs": "^5.2.4",
    "@react-navigation/material-top-tabs": "^5.3.4",
    "@react-navigation/native": "^5.1.3",
    "@react-navigation/stack": "^5.2.8",
    "@sayem314/react-native-keep-awake": "^1.0.3",
    "bad-words": "^3.0.3",
    "chinese-to-pinyin": "^1.3.1",
    "country-currency-map": "^2.1.7",
    "geofirestore": "^3.3.1",
    "hermes-engine": "^0.7.1",
    "i18n-js": "^3.5.1",
    "jsc-android": "^241213.1.0",
    "lodash.memoize": "^4.1.2",
    "moment": "^2.24.0",
    "prop-types": "^15.7.2",
    "react": "16.13.1",
    "react-native": "0.63.3",
    "react-native-audio": "^4.3.0",
    "react-native-autolink": "^1.8.1",
    "react-native-calendar-events": "^1.7.3",
    "react-native-calendars": "^1.212.0",
    "react-native-camera": "^3.6.0",
    "react-native-drag-sort": "^2.3.9",
    "react-native-elements": "^3.3.2",
    "react-native-fbads": "^7.0.5",
    "react-native-fbsdk": "^3.0.0",
    "react-native-geocoder-reborn": "^0.8.0",
    "react-native-geolocation-service": "^3.1.0",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-google-signin": "^2.0.0",
    "react-native-image-crop-picker": "^0.35.1",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-image-picker": "^1.1.0",
    "react-native-image-resizer": "^1.1.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-localize": "^1.3.3",
    "react-native-map-clustering": "^3.0.6",
    "react-native-maps": "0.25.0",
    "react-native-mime-types": "^2.2.1",
    "react-native-modal-datetime-picker": "^7.6.0",
    "react-native-orientation-locker": "^1.1.6",
    "react-native-permissions": "^2.0.2",
    "react-native-push-notification": "^6.1.3",
    "react-native-qrcode-svg": "^5.2.0",
    "react-native-reanimated": "^1.7.1",
    "react-native-responsive-fontsize": "^0.2.2",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.4.0",
    "react-native-snap-carousel": "^3.9.0",
    "react-native-sound": "^0.11.0",
    "react-native-svg": "^9.9.7",
    "react-native-swiper": "^1.6.0",
    "react-native-tab-view": "^2.15.2",
    "react-native-twitter-signin": "^1.1.1",
    "react-native-vector-icons": "^7.0.0",
    "realm": "^6.0.1",
    "rn-fetch-blob": "^0.11.2"
  },
  "devDependencies": {
    "@babel/core": "7.10.2",
    "@babel/runtime": "7.10.2",
    "@react-native-community/eslint-config": "0.0.5",
    "babel-jest": "^25.1.0",
    "eslint": "6.8.0",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

I will try create new fresh project instead of upgrade from old files and check for the issue again.

kkusanagi avatar Apr 14 '21 08:04 kkusanagi

Same error after trying new init project. Steps to reproduce. Init new project and go into project folder -> npm install react-native-fbads -> cd ios && pod install After pod install and get latest version as below

Installing FBAudienceNetwork (6.3.1)
Installing FBSDKCoreKit (9.2.0)
Installing ReactNativeAdsFacebook (7.0.5)

is it because i'm using npm 6.13.4 and Node v10.19.0?

No luck in fixing issue.

kkusanagi avatar Apr 17 '21 10:04 kkusanagi

any luck finding the solution? I am having same issue

tauseefnasir avatar Sep 03 '21 14:09 tauseefnasir

as a workaround it may help: https://github.com/callstack/react-native-fbads/issues/308#issuecomment-1329785139

beqramo avatar Nov 29 '22 13:11 beqramo