ajith-ab / react-native-receive-sharing-intent

A React Native plugin that enables React Native apps to receive sharing photos, videos, text, urls or any other file types from another app
MIT License
309 stars 112 forks source link

Xcode 12 unable to link after adding the Share extension: _OBJC_CLASS_$_RCTImageLoader #78

Closed LPitonakova closed 3 years ago

LPitonakova commented 3 years ago

I have followed the tutorial for iOS.

I am running XCode 12.5.

The first issue I had was that pod install gave me the following error:

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `react-native-receive-sharing-intent` depends upon `React-Core`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

I solved this by adding the following into my Podfile:

target 'MY_SHARE_EXTENSION' do
  use_modular_headers!
  use_native_modules!
  # Manually link packages here to keep your extension bundle size minimal
end

This produces a lot of warnings, but no installation errors.

However, in the linking stage of the app's build, I get the following:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTImageLoader", referenced from:
      objc-class-ref in libRNScreens.a(RNSScreenStackHeaderConfig.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have tried a number of different things, most notably from these threads:

However, the linking problem persists.

Could you please advise what to do? Thanks.

manjotssd commented 3 years ago

in Target Share Extension Removing all the imports under Linking/Other linker flags fixed it for me.

LPitonakova commented 3 years ago

thanks @manjotssd - this produces 165 build errors for me. Did you do anything else you think? Would you be able to share a screenshot of what the Linking / Other looks like for you? Or is it just completely empty?

manjotssd commented 3 years ago

@LPitonakova Screenshot 2021-06-18 at 7 18 14 PM select the share extension

from the targets before removing the reference . You can check the screenshot. I did it yesterday and as i remember this was the only thing i did also in the docs https://ajith-ab.github.io/react-native-receive-sharing-intent/docs/ios at bottom same is written. Make sure to select the correct target when removing the references.

LPitonakova commented 3 years ago

Thanks @manjotssd ! If you don't mind, could you please also share your package.json file and your Podfile? I wonder why this doesn't work for me..

manjotssd commented 3 years ago

@LPitonakova POD FILE Podfilerequire_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 'demo' do config = use_native_modules!

use_react_native!(:path => config["reactNativePath"])

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

pod 'Permission-Camera', :path => "../node_modules/react-native-permissions/ios/Camera.podspec" pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true

target 'DemoTests' do inherit! :complete

Pods for testing

end

use_flipper! post_install do |installer| flipper_post_install(installer) end end

target 'Demo-tvOS' do

Pods for Demo-tvOS

target 'Demo-tvOSTests' do inherit! :search_paths

Pods for testing

end end`

Package JSON { "name": "Demo", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android --no-jetifier", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@nozbe/watermelondb": "^0.22.0", "@nozbe/with-observables": "^1.3.0", "@react-native-clipboard/clipboard": "^1.7.0", "@react-native-community/async-storage": "^1.12.1", "@react-native-community/checkbox": "^0.5.8", "@react-native-community/cli-platform-android": "^4.13.0", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.10", "@react-native-community/picker": "^1.7.1", "@react-native-community/slider": "^3.0.3", "@react-native-firebase/app": "^11.1.0", "@react-native-firebase/messaging": "^11.1.0", "@react-navigation/drawer": "^5.9.3", "@react-navigation/material-top-tabs": "^5.2.16", "@react-navigation/native": "^5.7.3", "@react-navigation/stack": "^5.9.0", "appcenter": "4.0.2", "appcenter-analytics": "4.0.2", "appcenter-crashes": "4.0.2", "axios": "^0.21.1", "i18n-js": "^3.8.0", "i18next": "^19.9.2", "lodash.memoize": "^4.1.2", "moment": "^2.27.0", "react": "16.13.1", "react-fast-compare": "^3.2.0", "react-i18next": "^11.8.10", "react-native": "^0.64.2", "react-native-animatable": "^1.3.3", "react-native-base64": "^0.2.1", "react-native-biometrics": "^2.1.4", "react-native-bootsplash": "^3.1.2", "react-native-calendar-picker": "^7.0.0", "react-native-calendars": "^1.1260.0", "react-native-camera": "^3.40.0", "react-native-code-push": "^7.0.1", "react-native-crypto-js": "^1.0.0", "react-native-date-picker": "^3.3.0", "react-native-device-info": "^7.2.1", "react-native-dialog": "^8.0.1", "react-native-document-picker": "^4.1.1", "react-native-dropdown-picker": "^5.1.19", "react-native-fs": "^2.16.6", "react-native-gesture-handler": "^1.7.0", "react-native-keyboard-aware-scroll-view": "^0.9.3", "react-native-linear-gradient": "^2.5.6", "react-native-localize": "^2.0.2", "react-native-masked-text": "^1.13.0", "react-native-modal": "^11.7.0", "react-native-modal-selector": "^2.0.3", "react-native-navigation": "^4.8.4", "react-native-pager-view": "^5.1.2", "react-native-paper": "^4.7.1", "react-native-permissions": "^2.2.1", "react-native-qrcode-scanner": "^1.6.0", "react-native-reanimated": "^2.1.0", "react-native-receive-sharing-intent": "^1.1.0", "react-native-responsive-fontsize": "^0.4.3", "react-native-responsive-screen": "^1.4.1", "react-native-root-toast": "^3.2.1", "react-native-safe-area-context": "^3.1.7", "react-native-screens": "^2.10.1", "react-native-svg": "^12.1.0", "react-native-svg-transformer": "^0.14.3", "react-native-switch-selector": "^2.1.4", "react-native-tab-view": "^3.0.1", "react-native-touch-id": "^4.4.1", "react-native-vector-icons": "^7.1.0", "react-native-xml2js": "^1.0.3", "react-navigation": "^4.4.1", "react-redux": "^7.2.1", "react-xml-parser": "^1.1.8", "recyclerlistview": "^3.0.5", "redux": "^4.0.5", "redux-persist": "^6.0.0", "redux-saga": "^1.1.3", "remote-redux-devtools": "^0.5.16", "reselect": "^4.0.0", "rn-round-checkbox": "^1.0.0" }, "devDependencies": { "@babel/core": "7.11.5", "@babel/plugin-proposal-decorators": "^7.14.2", "@babel/runtime": "7.11.2", "@react-native-community/eslint-config": "1.1.0", "babel-jest": "25.5.1", "babel-plugin-module-resolver": "^4.1.0", "better-sqlite3": "^7.3.1", "chalk": "^4.1.0", "eslint": "6.8.0", "jest": "25.5.4", "metro-react-native-babel-preset": "0.59.0", "react-test-renderer": "16.13.1" }, "jest": { "preset": "react-native" } }