Apple Mach-O Linker Error when migrating to Swift 3 - ios

I have to migrate a project from Swift 2.3 to Swift 3. In this application there is also Objective C parts. So far I experienced several issues, but this one is really giving me a hard time: I updated all the Swift 3 libraries accordingly, and now I get an error in one library that is primarily being used in the Objective C part, which i don't know much of.
I run into this build issue:
ld: framework not found CocoaLumberjack
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is my pod file:
target 'SmartSpaces' do
xcodeproj 'SmartSpaces/SmartSpaces.xcodeproj'
pod 'CorePlot', :git => 'https://github.com/core-plot/core-plot.git'
pod 'Fingertips'
pod 'ReactiveCocoa', '~> 2.3.0'
pod 'CocoaLumberjack', '~> 2.0.2'
pod 'RestKit', '~> 0.26' end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.to_s == 'RestKit'
target.build_configurations.each do |config|
config.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework "CocoaLumberjack"'
end
end
end
Does anybody know how this issue can be fixed?

Related

Why does my iOS app produce a dyld error on launch?

I have a project running on Xcode 12.3; it's in Objective-C and uses CocoaPods. The 3rd party libraries are built only for devices, not for simulators, so when I run my app on iPhone with iOS 13, the project builds successfully but I get the following error:
dyld: Symbol not found: _$s9SwiftGRPC17ServerSessionBaseC15initialMetadataAA0G0CvM
Referenced from: /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/Core.framework/Core
Expected in: /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/SwiftGRPC.framework/SwiftGRPC
in /private/var/containers/Bundle/Application/EE50CA2F-F5D6-4DF3-B76F-2E580D604C4B/####.app/Frameworks/Core.framework/Core
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
(lldb)
The pod file is as below:
pod 'SwiftGRPC', '~> 0.9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'CleverTap-iOS-SDK', '~> 3.7.1'
Why am I getting this error and how can I resolve it?
Have you tried setting BUILD_LIBRARY_FOR_DISTRIBUTION to true for all your frameworks to ensure module stability?
You'll need to set the flag to true in your app (under project settings) as well as in your dependencies by adding a post install script at the end of your Podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
Original solution here

Why does my iOS project with Cocoapods try (and fails) to build on a x86_64 architecture? [duplicate]

This question already has answers here:
ld: framework not found Stripe for architecture x86_64
(4 answers)
iOS , ld: framework not found GoogleMaps for architecture arm64
(3 answers)
Closed 6 years ago.
I got the following error testing my test target in Xcode:
ld: framework not found GoogleMapsBase for architecture x86_64
My project is an iOS project so I don't really understand why it builds with a x86_64 architecture. When examining my Pods project, the build settings feature the following settings:
Base SDK: No SDK (Latest macOS)
Supported Platforms: macOS
Valid architectures: i386 x86_64
My Podfile looks like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'Foo' do
use_frameworks!
...
pod 'GooglePlaces', '2.0.1'
...
target 'FooTests' do
inherit! :search_paths
pod 'Quick', '~> 1.0'
pod 'Nimble', '~> 5.0'
end
end
What can I do to fix this issue?
UPDATE: cf this link for the answer of a similar question that helped me fix my issue.
A question. Do you literally included ... in your podfile? Or is it you are omitting other pods with this sign?
Now, the simpler edition of your podfile would be like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'Foo' do
use_frameworks!
pod 'GooglePlaces', '2.0.1'
end
target 'FooTests' do
pod 'Quick', '~> 1.0'
pod 'Nimble', '~> 5.0'
end
This should work. Let us know what you got.

GoogleSignIn/GIDSignIn.h file not found

I'm new to Unity iOS development and wanted to include a Google Play services in my Unity app. I've downloaded the Unity package (installed Cocoa, made sure my Pod file is set up correctly etc).
However, when I build my app I get GoogleSignIn/GIDSignIn.h file not found.
So far I've tried:
Installing 'Google/SignIn' using Cocoa (throws an invalid name
exception that)
Linking the GoogleSignIn bundle through Xcode linked
libraries (makes no difference)
Upgrading all packages (same as in Google/Signin) Adding
$(inherited) to linker flags (no change)
checking FrameWork Search path,Header Search path
Pods file:
platform :ios, '9.0'
target 'Unity-iPhone' do
pod 'GooglePlayGames', '~> 5.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end end end
I go through this links:
“GooglePlus/GooglePlus.h file not found” when trying to build my project
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1526
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1460
Change the pod file from below and again install the pod
platform :ios, '9.0'
target 'Unity-iPhone' do
pod 'GooglePlayGames', '~> 5.0'
pod 'Google/SignIn'
end

Adding Firebase/Messaging CocoaPod causes iOS app to not build

The iOS app worked fine before adding Firebase/Messaging, but after adding it and running 'pod update' I started getting these errors when building:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GTMLogger", referenced from:
objc-class-ref in FirebaseMessaging(GIPReachability_d54098c5c1e1fdc4fca31a4803478650.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my current Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'KarmaSous' do
pod 'Firebase'
pod 'FirebaseMessaging'
pod 'Firebase/Database'
pod 'Kingfisher', '~> 3.1.4'
pod "GMStepper"
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
Any help would be greatly appreciated, thank you!
Have you tried adding pod 'Firebase/Messaging' instead of pod 'FirebaseMessaging'?
I had same error, and I have solved the error.
Please make sure that "Edit Scheme > Build > Build Options > Find Implicit Dependencies" is checked.

Swift 3.0 xCode 8 Migration pod

i have some problems with xCode 8.
I have converted my .xCodeproject in swift 3.0 sintax
i Have installed all cocoapods compatible with swift 3.0
Here my pods
So every pod require the legacy swift version OR xCode return ditto error OR xCode return some error about the pods sintax. Please help me.
to remove the pods requiring legacy swift version manually changed to YES task, add this script to your podfile. It will go through your pods and set it to use the 3.0 version
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
configuration.build_settings['SWIFT_VERSION'] = "3.0"
end
end
end
1.latest xcode 8
2.if already pod file created in your project so then u do this command
open -e podfile
and then
use_frameworks!
target '<your project name>' do
pod 'Alamofire', '~> 4.4'
//your all pod put here above end
end

Resources