Unable to use Google Analytics for iOS - ios

I don't know what Happens to the code or google.
I just Downloaded the Sample App for Google Analytics for Google.
I downloaded it via pod using:
pod try Google
and chooses the option for Analytics.
After downloading when I build the project I am getting Linker Error.
Fully Stuck Tried All The way available in SO.
Removed -ObjC Flag
Removed -force-load Flag
Changed Load Common Section from Yes to NO
But none of the way help me Out. What is the issue with it.
Here is the Screen shot of the Error:

Here is the Following reason of this ERROR :
*Note - Integrated GooGle Analytic without CocoaPods.
If latest GA(Google Analytics) sdk is using then better to upgrade to Xcode 7 otherwise it will give you duplicate error (even if configured properly)
Running with Xcode 6.2 or < Xcode 7 then better to download September (August) Release Sdk.
Go with Xcode and select GA folder and right click - choose show in Finder then all files should be there . If yes then check is there two different copy exists in other folder .
Thanks

It basically says that there are functions duplications in the project...
Make sure the following:
The project does not have #import for .m files by mistake
In the projects build phases there are no file names duplications
There are no initialized variables in .h files e.g "int
variableA = 5"
If none of the above works, remove in project settings Other Linker
Flags "-ObjC", that will allow to load the same functions more then
one time.

Related

"Could not locate google-services.json or GoogleService-info.plist files" iOS Project, Unity, Mac Computer

I've been trying for the past two hours to figure this thing out! So I already created a project within my Firebase account; an iOS project. Downloaded the google-service-Info.plist files.
If I click Import New Asset and attempt to search for the file.. can't added it like that, I have to drag it into my folder.
I'm aware that the file must be put within the root folder (which I have done many times now), but I still encounter the same error message.
Could not locate google-services.json or GoogleService-info.plist files"
I removed all the Firebase files (SDK), re-installed them,.. same thing..
I also deleted the GoogleService-info.plist file and downloaded a brand new one, same thing!!! enter image description here
I'm currently using Unity 2018.2.1f1, My computer: macOS High Sierra, Version 10.13.6
I have same problem.
Add IOS and Android build component for Unity. Switch to the platform Android. It resolve you problem.
Check SDK status. See in screenshot below:
This happened to me right after adding a GoogleService-info.plist to a project that only had Android support before.
Doing Assets -> Reimport All also worked for me to get past this error.
In my case I missed the step where you generate those files on Firebase.
Generate them from your Firebase console by clicking the Unity icon in your project overview page. See more complete documentation here

React native facebook login in ios undefined symbols for architechture x864

I'm trying to add facebook login on react native latest version 0.49 by follow this tutorial
https://github.com/facebook/react-native-fbsdk
I did step by step and see some videos on youtube and did exactly but I still get the same 28 errors
I guess maybe it's because in the link Binary with Libraries I can't see the FBSDK, even I added it as explained on tutorial to Frameworks folder
I saw some posts in stack overflow e.g
React Native iOS build failed : Undefined symbols for architecture x86_64
but without any help.
thanks.
There is an issue with XCode 9, where when you drag and drop any files, it does not get added to the target.
You need to manually add them to your target in File inspector now.
This can happen not only with frameworks but other files as well. To prevent this issue, whenever you want to add any file or resource to your XCode project, you should first add that file/resource to the project folder and then right-click and then add to your XCode project using Add Files to ..

'Linker command failed with exit code 1' when using Google Analytics via CocoaPods

I'm trying to add Google Analytics to an iOS app written in Swift. I've followed the guide that adds the frameworks via CocoaPods and added a bridging header but I'm still getting:
Linker command failed with exit code 1
My podfile does have use_frameworks! so I'm wondering if that has anything to do with it... there is no additional information on the Analytics site from what I can see.
EDIT:
I've noticed that after viewing the full error message the following is displayed:
ld: '/Users/simon/Programming/VenueNow/Pods/GoogleUtilities/Libraries/libGTM_NSData+zlib.a(GTMNSData+zlib.o)' does not contain bitcode.
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
And searching for that issue brings up that Google updated to support bit code but hadn't updated the cocoa pods framework at that time.
Go to your build settings and switch the target's settings to ENABLE_BITCODE = YES for now.
I had this same issue. Fortunately you can use Google Analytics with BitCode enabled, but it's a bit confusing due to how Google had set up their CocoaPods support.
There's actually 2 CocoaPods you can use:
'Google/Analytics'
'GoogleAnalytics'
The first one is the "latest" but it's tied to the greater Google pods so it does not support Bitcode. The second one is for Analytics only and does support BitCode. However because the latter does not include extra Google pods some of the instructions on how to set it up are incorrect.
You have to use the v2 method of setting up analytics:
// Inside AppDelegate:
// Optional: automatically send uncaught exceptions to Google Analytics.
GAI.sharedInstance().trackUncaughtExceptions = true
// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
GAI.sharedInstance().dispatchInterval = 20
// Create tracker instance.
let tracker = GAI.sharedInstance().trackerWithTrackingId("XX-XXXXXXXX-Y")
The rest of the Google analytics api you can use the v3 documentation (you don't need to use v2).
The 'Google/Analytics' cocoapod as of this writing still does not support BitCode. See here
Had this issue, but it wasn't related to the bitcode setting. I had somehow ended up with duplicate framework files in the Frameworks folder of my XCode project. I deleted all frameworks files that were red (and duplicates). This solved the "Apple Mach O, Linker Command failed with exit code 1" error.
This worked for me:
you have to remove libPods.a library from Linked Frameworks and
Libraries section of target.
Make sure you open the .xcworkspace file not the project file from xCode Project menu when working with pods. That should solve the issue with linking.
Close Xcode, rename the folder. Then make a new folder with the previous name. Run the project, stop the project. Delete the new folder, rename old folder and re-run.
My iPad Pro simulator is affected with this issue. Its something that makes me upset, so much hard work... hopefully Google works through bugs for the next SDK.
When I changed 'iOS Deployment Target' from 'IOS 10.0' to current one (my phone's) 'iOS 10.2', the problem was gone for me.
Building Settings>Deployment>iOS Deployment Target
I resorted to adding Analytics via cocoa pods again and disabled bit code for now.
Hopefully a future cocoa pods version will support it.
You have another option... install Google Analytics without using CocoaPods:
https://developers.google.com/analytics/devguides/collection/ios/v3/sdk-download
I had same the problem with xcode 7.3. It is because, some of my .h and .m files were added twice.
This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.
Some times appeared if you declare a constant in the header file without static notation.
like this
const int k = 10;
it should be:
static const int k = 10;
Try to remove any trace of cocoapods pods using pod deintegrate then
Run pod install
Build Settings > Enable Bitcode > No

Error with Google Play Game Service on iOS

I am getting this error:
ERROR: GPGSAppController.mm GIDSignIn.h File not found error
I am using Google Play Game Service plugin for Unity for leaderboard and Achievements, and every thing is working fine in android but when I build to IOS and try to run my project to an iOS device I keep getting this error and I couldn't find a solution to it for hours now.
I tried to deleted everything related to Google Play service (After creating a back up of course) and the app installed and worked ok, except it was a bit laggy but that is a another issue. So I'm sure the problem comes from Google Play Service, but I have no clue how to fix it. Again I'm new to Xcode and iOS development in general and even Mac.
I also get this message after building the project in Unity:
TO FINISH CONFIGURING THE EXPORTED XCODE PROJECT
Add these frameworks:
AddressBook.framework
AssetsLibrary.framework
CoreData.framework
CoreTelephony.framework
CoreText.framework
Security.framework
libc++.dylib
libz.dylib
Add the following bundles and frameworks from the Google Plus
and the Google Play Games C++ SDKs. These can be downloaded from
https://developers.google.com/games/services.
GoogleOpenSource.framework
GoogleSignId.bundle
GoogleSignId.framework
gpg.bundle
gpg.framework
Note: Make sure the bundles are copied to application. This can be
verified under Build Phases/Copy Bundle Resources.
Add the '-ObjC' linker flag. To do this, select the top-level project
object, select the 'Unity-iPhone' build target, then go to the
Build Settings tab. Search for Other Linker Flags and add
the '-ObjC' flag to that list.
** Note: To run in the simulator, use Unity 4.6.8 or greater.
ios_instructions on plugin repository
But I have no idea how to do any thing above as am not familiar with iOS development. Any help is appreciated.
#aimozs answer was right for indicating where to add required files, a few google search gave me the answers;
From instructions (didn't work for me, scroll down)
AddressBook.framework
AssetsLibrary.framework
CoreData.framework
CoreTelephony.framework
CoreText.framework
Security.framework
libc++.dylib
libz.dylib
These can all be located directly when linking frameworks. (In my case, libc++.dylib and libz.dylib were already linked, and I couldn't find them somehow, but regenerating your xcode project should add these two again.
GoogleOpenSource.framework
I've found it here:
https://developers.google.com/+/mobile/ios/getting-started#step_1_creating_the_console_name_project
GoogleSignId.bundle
GoogleSignId.framework
Found them in:
https://developers.google.com/identity/sign-in/ios/sdk/
(I grabbed latest version Google Sign-In SDK 3.0.0)
gpg.bundle
gpg.framework
I found them here:
https://developers.google.com/games/services/downloads/sdks
(Grabbed Play Games C++ SDK Version 2.1)
Also, the following part of the message seemed important:
Make sure the bundles are copied to application
I tried to copy bundle files to root of the project, but I still get the same error.
Solution: CocoaPods and the podfile!
I saw the PodFile in xcode project directory!.
Here you go; make sure you followed these steps:
https://github.com/playgameservices/play-games-plugin-for-unity#ios-setup
Then see https://cocoapods.org/
sudo gem install cocoapods
pod repo update
pod install
open Unity-iPhone.xcworkspace
Way better than manually copying files everywhere! ;)
Note: I also had to disable bitecode because I was having a linker error concerning GoogleOpenSource:
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)
It doesn't seem to be compiled with bitcode enabled, solution in here: how to ENABLE_BITCODE in xcode 7?
Build, enjoy and focus on making awesome games!
Linked questions
There's also a small discussion here:
http://forum.unity3d.com/threads/googleplus-googleplus-h-file-not-found-gpgsappcontroller-mm-xcode.294398/
A similar issue on UnityAnswers:
http://answers.unity3d.com/questions/1098655/gpgsappcontrollermm-gidsigninh-file-not-found-erro.html
Im going through that aswell, and for #1 it has to be done in xcode, here's a screenshot of how to add those libs
And that is for #3
Hope that helps :) and I'll get back to you about #2 when I've found out about it ;)

Admob SDK - iOS -File not found

I have installed Google Analytics and Google AdMob SDK in my iOS project using Cocoapods. I have implemented both the functionalities in my app and everything looked okay for a week. Then suddenly, when I compiled the app, I received this error message:
"GADBannerView.h file not found". in "#import GADBannerView.h"
But I was able to see the header GADBannerView.h in my project under Pods target.
I did some research and found this error can happen due to SEARCH PATH in BUILD SETTINGS. Many faced similar issues when they moved the project from one machine to another machine but I didn't do that. So, instead of investigating on SEARCH PATH, I removed my GADBanner implementation from my project and commented line #import GADBannerView.h and my project compiled successfully.
I don't quite understand why the Google Analytics SDK is getting compiled successfully while AdMob is throwing a compilation error. I even did a pod update and still received the same error.
The SEARCH PATHS in my target is $(inherited) and ALWAYS SEARCH USER PATH is set to No
Starting at AdMob 7.0, AdMob has made the SDK a framework. Import it like so:
#import <GoogleMobileAds/GoogleMobileAds.h>
Go to: --> Build Settings --> Apple LLVM 7.1 - Language - Modules --> Enable Modules (C and Objective-C) --> set it to Yes.
According to the Google Ads Developer Blog we need to use:
#import GoogleMobileAds;
If you have a problem with the #import syntax you need to modify your project build settings. Search for Modules and set Enable Modules to YES.
First one is issue of latest SDK will not be used for Admob.
second is issue of Xcode 7.0 and you can try in Xcode xcode below 7 for till date,

Resources