iOS , ld: framework not found GoogleMaps for architecture arm64 - ios

I'm developing an app using google maps. I will explain what I did with google maps, and maybe you can help me.
I was using Google maps frameworks without POD, but after a few errors about Google map Key I deleted the google map frameworks reference and I installed it using POD. Everything is working fine, but when I hit
Product -> TEST
now I get this error:
ld: framework not found GoogleMaps for architecture arm64
Any idea how fix this?
Thank you!
Podfile looks like this Cocoapods v1.0 beta 6):
platform :ios, '8.0'
use_frameworks!
target 'Project' do
pod 'GoogleMaps'
target 'ProjectTests' do
inherit! :search_paths
pod 'Mockingjay'
end
end

Update Please check if you have same build settings in the Architectures and Build active Architectures only keys of the targets
Your podfile should look like this
platform :ios, '8.0'
use_frameworks!
target 'Project' do
pod 'GoogleMaps'
end
target 'ProjectTests' do
//inherit! :search_paths
pod 'Mockingjay'
end
End the project target before you start the ProjectTest target, also why you add inherit! :search_paths? it's usually not needed unless you have some special requirement
Old Answer
If you want to you pods in the Test target than you have to add then in the test also the same way you have added in project's main target
So your cocoa pods like this if "SwiftCocoaPods" is your main target name
//other top level imports
target “SwiftCocoaPods” do
pod "GoogleMaps"
end
target “SwiftCocoaPodsTests” do
pod "GoogleMaps"
end
Then you should add pods for the test also like "SwiftCocoaPodsTests". you may replace the name with whatever you Test target name is
Else if you want to add the same pods in the multiple target you can use def and use that in all the targets which looks like this
def project_pods
pod "GoogleMaps"
//add other pods which you want in all the targets
end
target “SwiftCocoaPods” do
project_pods
end
//only add project_pods instead of pods individually
target “SwiftCocoaPodsTests” do
project_pods
end

This works for me:
platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
def all_pods
pod 'GoogleMaps'
end
abstract_target 'Map Base' do
all_pods
target 'Map' do
end
target 'Unit Tests' do
end
target 'Device Tests' do
end
end

You can try this workaround by opening Xcode with Rosetta as suggested in https://github.com/googlemaps/google-maps-ios-utils/issues/355#issuecomment-800912985
It will hit your performance but works.
1 - With Xcode closed (Important) Go to finder -> Applications
2 - Right Click on Xcode and select "Get Info"
3 - On the info panel check "Open using Rosetta"
4 - Double Click in the large bottom preview of the info panel.
See this comment:
https://github.com/googlemaps/google-maps-ios-utils/issues/355#issuecomment-1060959728

Related

Undefined symbols for architecture arm64: linker command warning

I updated my pods, and then after closing the project and reopening it, I received this error that I've been trying to figure out for 5 hours, and nothing has worked for me. I've been told to change the architectures, but all that I've tried isn't working, and I'm struggling a lot. Here is my pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'Vloggle' do
# Comment the next line if you're not using Swift and don't want to use
dynamic frameworks
use_frameworks!
pod 'Firebase/Auth'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
pod 'SDWebImage'
pod 'KILabel'
pod 'Firebase'
pod 'Firebase/Messaging'
pod 'ColorSlider'
pod 'lottie-ios'
# Pods for Vloggle
target 'VloggleTests' do
inherit! :search_paths
# Pods for testing
end
target 'VloggleUITests' do
inherit! :search_paths
# Pods for testing
end
end
Also, here is a screenshot of my build settings.
Here is the error message
Latest iOS version supports 64bit of Architecture. So you have to use Valid Architectures. You can check this in the "Architecture" section in build settings.
You can see the "Architecture" setting in the screenshot which is as follows:-
If your architecture is correct then check the "Other Linker Flags".
You can change the "Other Linker Flags" in the "Build Settings".
Search "Other Linker Flag" in the search area in the "Build Settings" and add the following code in it
$(inheriterd) will add all type of linker flags generated by the pods while installation of pods
https://i.stack.imgur.com/LgHV6.png
https://i.stack.imgur.com/Xouyo.png
can you please check the following settings in your project:-
1) Select your project target
2) Go to Build Phases
3) Go to Link Binary With Libraries
4) Press + to link
Make sure all libraries under Workspace have been added. If any library is missing then please add the missing library. Please check the attached screenshot
https://i.stack.imgur.com/NghA7.png

Targets within a target in a Podfile

I am trying to install the Google Mobile Ads SKD into my Xcode project. I installed Cocoapods and then initialized a Podfile into my project:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
target 'Cubical' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Cubical
target 'CubicalTests' do
inherit! :search_paths
# Pods for testing
end
target 'CubicalUITests' do
inherit! :search_paths
# Pods for testing
end
end
However, I don't understand why there are targets within my main project (Cubical). I never really used CubicalTests or CubicalUITests, since I don't really need to test my UI or any snippet of code. I was thinking of removing these two folders.
My questions are,
1) Is there any drawback in removing the Tests and UITests folders from my Xcode project? And if I do, can I just simply delete those two targets from my Podfile?
2) Let's say I was going to keep those two targets. Would I have to add the pod to all three targets? Or do the two nested targets inherit any pods of target 'Cubical'
3) Do I need to add to Linked Frameworks the Google Mobile Ads SDK? Or is this already done by Cocoapods?
My final pod would look like this:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
target 'Cubical' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
# Pods for Cubical
target 'CubicalTests' do
inherit! :search_paths
# Pods for testing
end
target 'CubicalUITests' do
inherit! :search_paths
# Pods for testing
end
end
Question 1:
There is no issue when you are removing Tests,CubicalUITests targets & folders, If you don't need to perform that kind of tests.
Question 2:
You can share pods with several targets like below,
def shared
pod 'Google-Mobile-Ads-SDK'
end
target 'Target1' do
shared
end
target 'Terget2' do
shared
end
Global pods for multiple targets
#Global Pod for all targets
pod 'Google-Mobile-Ads-SDK'
target 'target1' do
pod 'Fabric' #Pod for nested Target. i.e., Google-Mobile-Ads-SDK + Fabric
end
target 'target2' do
pod 'RadioButton'#Pod for nested Target. i.e., Google-Mobile-Ads-SDK + RadioButton
end
Pods for nested targets:
#Global Pod for all targets
pod 'Google-Mobile-Ads-SDK'
target 'target1' do
pod 'RadioButton' #Available for target1 and target2
target 'target2 copy' do
pod 'Fabric' #Available for target2 only
end
end
Question 3:
The linked frameworks are automatically done by cocoapods. See here you need to link the framework by using frameworks without cocoapods.

Firebase module not found

I have followed the instructions for adding firebase to an iOS project for Firebase 3. I have opened the workspace in xcode but when I add the import for Firebase, it says "no such module Firebase".
As the previous quickstart projects are deprecated, I don't have a working example to compare to.
Can someone point me in the right direction or to a working example?
The setup instructions say to use pod 'Firebase'.
I changed to this:
pod 'Firebase/Core'
pod 'Firebase/Database'
and it is happy now.
Adding ${SRCROOT}/Pods/Firebase/CoreOnly/Sources into the target's "Header search paths" fixed the problem. Steps:
1.Select your target
2.Go to Build Settings
3.Search for header search path
4.Add ${SRCROOT}/Pods/Firebase/CoreOnly/Sources
Since you might not get analytics by changing it by doing that, changing your podFile to include this helped me
target 'yourProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for yourProject
pod 'Firebase'
pod 'Firebase/Auth'
target 'yourProjectTests' do
inherit! :search_paths
# Pods for testing
end
target 'yourProjectUITests' do
inherit! :search_paths
# Pods for testing
end
end

CocoaPods and Realm in Swift

Using Xcode-6.3.1, iOS-8.3 and MacOS-10.10.3, I am trying to use RealmSwift (0.92.3) and CocoaPods 0.37.1
I use the following procedure :
install cocoapods (in terminal):
$ sudo gem install cocoapods
Create new Xcode project (named MyApp)
Create Podfile
platform :ios, '8.3'
use_frameworks!
target 'MyApp' do
pod 'RealmSwift', '>= 0.92.3'
end
target 'MyAppTests' do
pod 'RealmSwift', '>= 0.92.3'
end
Place the Podfile in the MyApp folder (next to MyApp.xcodeproj)
Download the newest Realm (0.92.3 from here) (i.e. Swift version)
unzip it
go to /ios folder
copy RealmSwift.framework also to your MyApp-project folder
(after Point 4 and 5 you end up like in the picture here)
Inside a terminal, go to your MyApp-folder and type
pod install
After pod-install, I end up with the following text inside the terminal:
After that, I simply open the new MyApp.xcworkspace
It basically looks ok - except: NO FRAMEWORK SEEMS TO BE FOUND !! (see screenshot below)...
What am I still missing ????
Any help greatly appreciated!
I finally found out that the "red" colored missing frameworks are no harm. Using CocoaPods these frameworks are not physically there - therefore Xcode cannot change the color. It, for sure, does not indicate a mistake here...
THREFORE THE ABOVE WORKFLOW (pt 1-8) IS CORRECT !
However, the Podfile above is not the right one if you want to use your "MyApp WatchKit Extension". The correct one is:
xcodeproj 'MyApp.xcodeproj'
workspace 'MyApp.xcworkspace'
platform :ios, '8.3'
source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
link_with 'MyApp', 'MyApp WatchKit Extension'
def shared_pods
pod 'RealmSwift', '>= 0.92.3'
end
target 'MyApp' do
shared_pods
end
target 'MyAppTests' do
shared_pods
end
target 'MyApp WatchKit Extension' do
shared_pods
end
Also, it is important that you still "import RealmSwift" in your Realm-Object definition(s) as can be seen in an example below:
Also, if you intend to use your Realm-Object in two targets (i.e. "MyApp" and "MyApp WatchKit Extension"), make sure you select both the corresponding targets in the target selection pane of your RealmObject.swift file (see image below):

Cocoa pods and Watchkit Extesion

I try to build a WatchKit Extension for my app...
I Updated the pods file to look like this:
platform:ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
link_with 'my-team-ios', 'My Team WatchKit Extension'
def shared_pods
pod 'DOSingleton'
pod 'JSONModel'
pod 'MagicalRecord'
end
target :'My App' do
shared_pods
pod 'Facebook-iOS-SDK', '~> 3.23.1'
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
... some more pods here...
end
target :'My Team WatchKit Extension' do
shared_pods
end
How I install the pods and don't get an error...
But, when I build the App, I get this error:
ld: framework not found Pods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What is my problem here?
I'm using Pod 1.2.1 and facing the same problem i.e. No such module XYZ and for anyone who came across the same issue here what I did to overcome it:
use_frameworks!
def shared_pods
pod 'XYZ'
end
target 'MyApp' do
platform :ios, '8.0'
shared_pods
pod 'Blah'
pod 'blah'
end
target 'Watch Extension' do
platform :watchos, '3.2'
shared_pods
end
I just added platform under each target e.g platform :watchos, '3.2' which was missing before and it solved my problem.
You need to open the xcworkspace file instead of the project file when using CocoaPods.
The problem is when updating to cocoapods 0.36.x they are now creating Frameworks out of each pod library. See the blog post about it.
This causes issues with any pod library that is dependent on other pods and how its referencing them in their import statements, or how your code is importing them as well. The Pod process now turns them into frameworks and when they used to be imported as
#import "ThisOtherPodClass.h"
Now need to be imported as
#import <ThisPodsFrameworkName/ThisOtherPodClass.h>
There is a new version of cocoa pods .38, that is designed to support WatchKit. However, if you want to work with the current version, check o make sure that libPods.a is added to the Target, WatchKit Extension in Included Libraries and Frameworks. Second, make sure that Pods.debug and Pods.release are added to Watchkit Extension in the General tabl
https://github.com/CocoaPods/CocoaPods/issues/3382
neonichu commented on Apr 15, 2015
would start by making sure OTHER_LDFLAGS isn't overwritten with unnecessary things, both in the project and the targets.
That set OTHER_LDFLAGS in buids settings solved my issus.
Try to change this lines
target :'My App', target :'My Team WatchKit Extension'
and remove colons:
target 'My App', target 'My Team WatchKit Extension'
I found a "temporally solution" for me:
Switch back to CocoaPods 0.35
Now everything is working fine, with our any changes to my project / pod file (except removing the 'use_frameworks!')
I think, that should not be the final solution here...
A short test by upgrading again to 0.36 raises the same problem as before...
Here is a link to the GitHub Issue:
Rename the target so it doesnt include any spaces -> MyTeamWatchKitExtension both in podfile and also in General -> Targets. This solved my problem

Resources