Comments (19)
@Gustash, Sure I'll create and share a repo that reproduces this issue.
from react-native-share-menu.
I've found a workaround to fix the the Apple Mach-O Linker error
problem. Create a swift file in project and when prompted to create a bridging file select yes. Re-build the project again and it builds successfully. For more info refer https://stackoverflow.com/questions/52536380/why-linker-link-static-libraries-with-errors-ios/61582562#61582562
from react-native-share-menu.
Hello @RajatKumarChahar, Require Only App-Extension Safe API
isn't supposed to be set in the Share Extension target, but in every target inside the Pods
project.
To fix this, add a post_install
script anywhere in your Podfile
like this:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end
end
end
Also, unless you're going to use the same native modules in your Share Extension as you do in your main app, I would recomment slimming down the ShareExtension target by only doing this:
target 'ShareExtension' do
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 'RNShareMenu', :path => '../node_modules/react-native-share-menu'
end
This way you can manually link only the native modules you're going to use in your Share Extension, and keep the bundle size minimal.
from react-native-share-menu.
Hello @Gustash, I've added post_install script. Now the error which was coming earlier is not coming but now
Apple Mach-O Linker error
is coming.
I've cleaned the project and built the app again but it's still coming.
from react-native-share-menu.
Can you check if you have. -ObjC
abd -lc++
in your Other Linker Flags
on the Share Extension's Build Settings
?
If not, add those and try again please.
from react-native-share-menu.
Yes I've checked Other Linker Flags
on the Share Extension's Build Settings and both -ObjC
and -lc++
are present.
To be more specific errors are
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
Undefined symbols for architecture x86_64:
"Foundation._convertErrorToNSError(Swift.Error) -> __C.NSError", referenced from:
RNShareMenu.ShareMenuReactView.dismissExtension(Swift.String?) -> () in libRNShareMenu.a(ShareMenuReactView-B190363797C90082.o)
reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned __C.NSString?, @unowned __C.NSString?, @unowned __C.NSError?) -> () to @escaping @callee_guaranteed (@guaranteed Swift.String?, @guaranteed Swift.String?, @guaranteed Swift.Error?) -> () in libRNShareMenu.a(ShareMenuReactView-B190363797C90082.o)
"Foundation.URL.pathExtension.getter : Swift.String", referenced from:
RNShareMenu.ShareMenuReactView.extractMimeType(from: Foundation.URL) -> Swift.String in libRNShareMenu.a(ShareMenuReactView-B190363797C90082.o)
(extension in RNShareMenu):Foundation.URL.extractMimeType() -> Swift.String in libRNShareMenu.a(URL+Extensions.o)
"Foundation.URL.absoluteString.getter : Swift.String", referenced from:
closure #1 (__C.NSSecureCoding?, Swift.Error?) -> () in RNShareMenu.ShareMenuReactView.extractDataFromContext(context: __C.NSExtensionContext, withCallback: (Swift.String?, Swift.String?, __C.NSException?) -> ()) -> () in libRNShareMenu.a(ShareMenuReactView-B190363797C90082.o)
closure #2 (__C.NSSecureCoding?, Swift.Error?) -> () in RNShareMenu.ShareMenuReactView.extractDataFromContext(context: __C.NSExtensionContext, withCallback: (Swift.String?, Swift.String?, __C.NSException?) -> ()) -> () in libRNShareMenu.a(ShareMenuReactView-B190363797C90082.o)
"static Foundation.URL._unconditionallyBridgeFromObjectiveC(__C.NSURL?) -> Foundation.URL", referenced from:
@objc static RNShareMenu.ShareMenuMessenger.share(application: __C.UIApplication, openUrl: Foundation.URL, options: [__C.UIApplicationOpenURLOptionsKey : Any]) -> () in libRNShareMenu.a(ShareMenuMessenger.o)
.
.
.
.
from react-native-share-menu.
Did you create a Bridging Header in your Share Extension, like the docs mention?
from react-native-share-menu.
No, because it was mentioned for Custom IOS share View
which was optional so I didn't.
from react-native-share-menu.
It shouldn't be necessary if you're not using a custom view, but can you please try it just as a sanity check?
from react-native-share-menu.
I added the ShareExtension-BridgingHeader
but it's still giving the same error
from react-native-share-menu.
Is it possible to get a repo that reproduces this problem? If you can't share your project, a stripped down version of it without any JS code and keys would be helpful
from react-native-share-menu.
@RajatKumarChahar what version of Xcode are you using btw?
from react-native-share-menu.
@Gustash, I am using Xcode: 11.2.1
from react-native-share-menu.
@RajatKumarChahar okay, is it possible for you to share a project that reproduces that issue? I can't replicate it locally so I'd need to take a closer look at an affected project
from react-native-share-menu.
HI @Gustash I'm having the same issue. Did you find a solution for this?
from react-native-share-menu.
@jgardi which problem are you having? The first, or the second one?
from react-native-share-menu.
@RajatKumarChahar you mean creating a bridging header on the main app target?
from react-native-share-menu.
@Gustash, Yes
from react-native-share-menu.
Thanks for letting me know. These instructions are already on the README. I will close this issue as it seems like it was just a step missed on the instructions
from react-native-share-menu.
Related Issues (20)
- 'openURL:options:completionHandler:' is unavailable: not available on iOS
- Crash on Android 12
- Android Manual Steps
- Share intent for multiple links crashing
- Issue While Building the app after installation HOT 2
- CustomView not opening for iOS
- ShareMenuReactView.continueInApp causes origin app to freeze
- Out of memory crashes are more frequent on iOS 17 when sharing certain URLs HOT 6
- Update example project
- Support "No Share Extension UI" flow on iOS HOT 2
- Add a privacy manifest for XCode 15
- Improve app group configuration for iOS
- Set up changelog format
- Do a test release HOT 1
- Ensure iOS share extension can load files of all types, from all apps
- Report content types more clearly (Android and iOS)
- Add a method to manage copied files on iOS
- Add support for the New Architecture
- v7.0 Tracking issue
- Anyone get this working with Expo? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-share-menu.