XCode - How to include React Native libraries in Share Extension? - objective-c

I'm attempting to create a Share Extension in a React Native application.
At compilation time, I'm running into the following error:
Apple Mach-O Linker Error
"_OBJC_CLASS_$_RCTRootView", referenced from:
"_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
"_RCTRegisterModule", referenced from:
Linker command failed with exit code 1
(use -v to see invocation)
I'm interpreting this error as the Share Extension is unable to find/link the associated libraries.
I've attempted to define the libraries in the Share Extension's:
General -> Frameworks and Libraries
Build Settings -> Search Paths -> Library Search Paths
The project here: https://github.com/Meandmybadself/react-native-share-starter
Versions
XCode: 11.3.1
Podfile iOS version: 11.0
react-native: 0.63.4

Related

Use swift static library in Unity iOS

I have been trying to integrate my Unity game with the iOS static library that I found on Github. The library is in Swift, however, I forked the library and I provided objective-c bindings necessary to make a call from C# code.
My static library is available in my xCode project under the products tab. To use it in Unity I copy-pasted generated library from the directory available under "Reveal in file explorer" to Unity. I put my library in the Plugin directories.
When I run my game on iOS simulator via generated by Unity solution I'm getting an error:
2020-11-02 13:56:43.450062+0100 NewUnityProject[4357:59213] Error loading /Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/1C4440FF-C7C6-486B-ADC8-F8A794A83CD9/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/1C4440FF-C7C6-486B-ADC8-F8A794A83CD9/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework, 265): Symbol not found: _$s10Foundation3URLVMn
Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
Expected in: flat namespace
in /Users/user/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
2020-11-02 13:56:43.473282+0100 NewUnityProject[4357:59213] Error loading /Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/1C4440FF-C7C6-486B-ADC8-F8A794A83CD9/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/1C4440FF-C7C6-486B-ADC8-F8A794A83CD9/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework, 265): Symbol not found: _$s10Foundation3URLVMn
Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
Expected in: flat namespace
in /Users/user/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
To validate Unity support step by step I've created an objective-c static library - Untiy was able to make a call to library and I didn't get an error. After that I added swift support to my objective-c library and then I got once again a problem with flat namespace:
2020-11-02 13:37:12.848568+0100 NewUnityProject[3034:44789] Error loading /Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/4E2199BA-7743-484E-AD01-636C4296BE85/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/4E2199BA-7743-484E-AD01-636C4296BE85/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework, 265): Symbol not found: _$sBOWV
Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
Expected in: flat namespace
in /Users/user/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
2020-11-02 13:37:12.874398+0100 NewUnityProject[3034:44789] Error loading /Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/4E2199BA-7743-484E-AD01-636C4296BE85/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/Users/user/Library/Developer/CoreSimulator/Devices/4D7307D5-D320-4AEB-A0DE-581C61CB3E14/data/Containers/Bundle/Application/4E2199BA-7743-484E-AD01-636C4296BE85/NewUnityProject.app/Frameworks/UnityFramework.framework/UnityFramework, 265): Symbol not found: _$sBOWV
Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
Expected in: flat namespace
in /Users/use/Library/Developer/Xcode/DerivedData/Unity-iPhone-cwkdvrbwlxwbfzbpzacumxcttcmy/Build/Products/ReleaseForRunning-iphonesimulator/UnityFramework.framework/UnityFramework
I have been trying to set different xCode flags like "Always Embed Swift Standard Libraries" or "Enable Modules" but still no luck to run my game on iOS simulator.
Any hints are very appreciated.

Apple Mach-O Linker (ld) Error - Importing Frameworks

These frameworks work within another project but when creating a new project, it errors. The new project is blank and it fails because I import the frameworks. I am clicking and dragging the frameworks into Xcode.
Xcode 8.3.2 & Xcode 7.3.1
Apple Mach-O Linker (ld) Error Group
clang: error: linker command failed with exit code 1 (use -v to see invocation)
These are my frameworks:
Screenshot 3
I have tried:
Recreating the project
Readding the frameworks
Set Build Settings -> Framework Search Paths -> $(PROJECT_DIR) to recursive
Checked frameworks added to Build Settings -> Link Binary With Libraries
Clean & Clean Build Folder

Qt link library (C++ mix with objective C) error

I am using Qt to build UI Application,
The Qt application supposed to link to a static library (.a file)
The library is written by C++ and Objective C (*.mm) files.
I setup the Qt project file and linked the static library, but Qt Creator always gets linking error, and error is related with the function implement on *.mm which locates in the static library.
Question:
The Qt application how to link the library?
that's pure C++ application (Qt application) link to static library with C++ and ObjectiveC mixed (.a file).
update: link error
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_QTCaptureDevice", referenced from:
objc-class-ref in libmyapi.a(myTestFunction_mac.o)
"_QTMediaTypeVideo", referenced from:
myTestFunction() in myapi.a(myTestFunction_mac.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [myApp.app/Contents/MacOS/myApp] Error 1
14:38:06: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project myApp (kit: Desktop Qt 5.1.0 clang 64bit)
Qt5.1 with clang, support C++11
static library myapi.a, built by Xcode4.6 without error. Only one file is myTestFunction_mac, using QTKit framework.
myApp links myapi.a, but the myTestFunction_mac.mm implantation file has linking error.
You need to add QTKit framework to your app target.
Xcode 4
Click on the project in the browser pane to the left.
Click on the target under Targets.
Click on the Summary tab.
Expand Linked Frameworks and Libraries if not expanded.
Click on the + icon and type QTKit into the search box and add QTkit.
Xcode 3
Right click on the project.
Select Add-->Existing Frameworks.
Add QTkit.

Apple Mach-O Linker Error lxml

I just upgraded xcode to 4.5 and now i get an error when compiling :
ld: library not found for -lxml2.2.7.3
cland: error: linker command failed with exit code 1
I did not change my code after the upgrade...
So?
thanks!
Click on your projekt ☞ target ☞ build phases ☞ link binary with libraries
then remove lxml2.2.7.3.dylib and add lxml2.dylib (if your project does not depend on a specific version of that library).
For my ionic project, I found that opening the .xcworkspace instead of .xcodeproj fixed this issue

Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1

My XCode version is 4.2 for iOS 5.0. I choose "LLVM GCC 4.2" as the compiler. When I compile my project, it show me the following error:
ld: warning: directory not found for option '-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/gcc/arm-apple-darwin10/4.0.1'
ld: warning: directory not found for option '-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/gcc/arm-apple-darwin10/4.2.1'
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
Please help me figure out why this is happening and how to fix it.
The libz.1.2.3 library does not exist anymore (or at least is not included in the SDK). In your project settings, link with a newer version of the library like libz.1.2.5.