Google Analytics doesn't work on new iOS project - ios

I have created a new iOS project and added Google Analytics support following by official instructions.
I've added to Frameworks:
libGoogleAnalyticsServices.a
AdSupport.framework
CoreData.framework
SystemConfiguration.framework
libz.dylib
But it doesn't work with the errors:
ld: warning: directory not found for option '-L/Users/.../Sources/GoogleAnalytics'
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteErrorDomain", referenced from:
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteStoreType", referenced from:
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSOverwriteMergePolicy", referenced from:
-[GAIDataStore contextWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix it? And does it support arm64?

From Google Analytics developer page
The Google Analytics SDK uses the CoreData and SystemConfiguration frameworks, so you will need to add the following to your application target's linked libraries:
libGoogleAnalyticsServices.a
AdSupport.framework
CoreData.framework
SystemConfiguration.framework
libz.dylib
Looks like you are missing out CoreData.framework.
Running the lipo -info command on the GA library.
xcrun -sdk iphoneos lipo -info libGoogleAnalyticsServices.a
Gives result,
Architectures in the fat file: libGoogleAnalyticsServices.a are: armv7 armv7s i386 x86_64 arm64
So it does support arm64.
Hope that helps!

Thanks for all! The following steps helped me:
Remove CoreData.framework.
Add again CoreData.framework.
arm64 is now supported. Thanks to Amar.
Now I should fix the last warning:
ld: warning: directory not found for option '-L/Users/.../Sources/GoogleAnalytics'
It happens because I work with the project on different users.

You should add the libsqlite3.0.dylibfile to your frameworks.
To do this, under the projects target, on the general tab, you will find "Linked Frameworks and Libraries", just select the '+' button, and add the framework from there

Related

Getting linker error while Gmail Integration

I am trying to integrate Gmail for login .
I have followed every step of there documentation but getting the following linker errors.
Note:- I am using manual SDK rather than Cocoa Pods.
ld: warning: directory not found for option '-F/Users/harpreet/Documents/FacebookSDK'
Undefined symbols for architecture x86_64:
"_GSDK_NSClassFromString", referenced from:
l010 in GoogleSignIn(GIDSignIn.o)
l059 in GoogleSignIn(GIDSignIn.o)
"_OBJC_CLASS_$_GSDK_GTMOAuth2Authentication", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn.o)
objc-class-ref in GoogleSignIn(GIDAuthentication.o)
"_OBJC_CLASS_$_GSDK_GTMOAuth2Keychain", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn.o)
"_OBJC_CLASS_$_GSDK_GTMOAuth2SignIn", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn.o)
objc-class-ref in GoogleSignIn(GIDAuthentication.o)
"_OBJC_CLASS_$_GSDK_GTMOAuth2ViewControllerTouch", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn.o)
"_OBJC_CLASS_$_GSDK_GTMSessionFetcher", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn.o)
objc-class-ref in GoogleSignIn(GIDRuntimeConfigFetcher.o)
"_OBJC_CLASS_$_GSDK_GTMSessionFetcherService", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn.o)
"_OBJC_CLASS_$_GSDK_OpenInChromeController", referenced from:
objc-class-ref in GoogleSignIn(GIDSignIn.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 sure to also add:
GoogleUtilities.framework
GoogleSymbolUtilities.framework
GoogleAuthUtilities.framework
GoogleNetworkingUtilities.framework
GoogleAppUtilities.framework
And the ones listed in the official documentation:
AddressBook.framework
SafariServices.framework
SystemConfiguration.framework
If you use the Google icon, import:
GoogleSignIn.bundle
Find the official documentation here
add all this from sdk(google_signin_sdk_4_0_0) to your project
GoogleAppUtilities.framework
GoogleAuthUtilities.framework
GoogleNetworkingUtilities.framework
GoogleSymbolUtilities.framework
GoogleUtilities.framework
GoogleSignIn.framework
GoogleSignIn.bundle
Go to
build Phases -> link binary with Libraries
add this framework
SafariServices.framework
AddressBook.framework
SystemConfiguration.framework
also add this two files
libc++.tbd
libz.tbd
Make sure you also added:
GoogleAuthUtilities.framework
GoogleNetworkingUtilities.framework
GoogleAppUtilities.framework
GoogleSymbolUtilities.framework
SafariServices.framework
Also, if you need too, add
GoogleSignIn.bundle
to your bundle resource.
This works for me

GoogleMaps for iOS Linker Error

While building the Application i am getting the following error i have searched a lot but i am unable to figure out what is the problem.
ld: warning: ignoring file /Users/username/GoogleMaps/GoogleMaps.framework/GoogleMaps, missing required architecture arm64 in file /Users/username/GoogleMaps/GoogleMaps.framework/GoogleMaps (2 slices)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GMSPolyline", referenced from:
objc-class-ref in GPSController.o
"_OBJC_CLASS_$_GMSCameraPosition", referenced from:
objc-class-ref in GPSController.o
"_OBJC_CLASS_$_GMSMutablePath", referenced from:
objc-class-ref in GPSController.o
"_OBJC_CLASS_$_GMSMarker", referenced from:
objc-class-ref in GPSController.o
"_OBJC_CLASS_$_GMSMapView", referenced from:
objc-class-ref in GPSController.o
"_OBJC_CLASS_$_GMSServices", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using GoolgeMaps SDK 1.4.3
PS:- I am relatively new to iOS programming so please avoid any blunders.
Adding value $(inherited) to BuildSettings->Linking->Other Linker Flags of your target
If you are developing an SDK/framework/POD you should do the same as above but under target name PROJECTNAME_tests.
Should fix the issue.
I had this problem too, and my solution was to add the frameworks to
Target -> Build Phases -> Link Binary With Libraries
ok I figured out the Problem
My Library was not built for 64-bit but i was trying to use that settings for my app, after i removed arm64 from architecture i successfully build the application.

XCODE 6.1.1 Framework issue

I have built a cocoa framework via XCode 6.1.1, also created a universal version of the framework, then when I import the framework into a project, an compiling error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_UIResponder", referenced from:
_OBJC_CLASS_$_AppDelegate in AppDelegate.o
"_OBJC_METACLASS_$_UIResponder", referenced from:
_OBJC_METACLASS_$_AppDelegate in AppDelegate.o
"_UIApplicationMain", referenced from:
_main in main.o
"_OBJC_METACLASS_$_UIViewController", referenced from:
_OBJC_METACLASS_$_ViewController in ViewController.o
"_OBJC_CLASS_$_UIViewController", referenced from:
_OBJC_CLASS_$_ViewController in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Wonder to know why?
And how to analyse the cause of the problem?
You have to add the armv7 architecture to your framework before building it.
Because the project where you use the framework in has this architecture.
You also can check the path to the framework (framework search-path)

Include WebRTC in iOS project

I trying to deal with the AppRTCDemo projet but I am getting error.
Which library I forget to include ?
Log error :
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_RTCVideoRenderer", referenced from:
objc-class-ref in VideoView.o
"_OBJC_CLASS_$_RTCSessionDescription", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RTCICECandidate", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RTCVideoCapturer", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RTCPair", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RTCMediaConstraints", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RTCPeerConnectionFactory", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RTCICEServer", referenced from:
objc-class-ref in APPRTCAppClient.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks
The solution is to set the "Other Linker Flags" in the build setting of your project to $(inherited).
Then it will be an inherited link options from the workspace.
Maybe this library isn't built for armv7s processors.
Is it static lib built in .a file?
If so, you can run in console lipo -info command to see what architectures is this library built for.
For example, this command for some library somelib.a lipo -info somelib.a gives output:
Architectures in the fat file: somelib.a are: armv7 i386
If armv7s architecture isn't supported, but armv7 is, you can also run your project, try setting this in your build options:
"Build Active Architecture Only" YES --> NO.
You may be testing on iPhone 5 or above which is on armv7s architecture (see http://iossupportmatrix.com/ for more info).
The AppRTCDemo was built on armv7, that assume to run it on devices issued between the iPhone 3GS and the iPad mini (that includes iPhone 4 and 4s).
Regards,
S.
you have to run the app in ios device....not in simulator

Need help in iOS lib armv7 and 64 bit version

I'm creating a project with Core-Plot lib.
I add the lib with static way.
How can I run my app in 32 + 64 bit devices?
if I run lipo libCorePlot-CocoaTouch.a -info
console response:
Architectures in the fat file: libCorePlot-CocoaTouch.a are: armv7 armv7s arm64
But this library works only with 32bit devices/simulator with 64bit simulator give me this error:
ld: warning: ignoring file PATH/libCorePlot-CocoaTouch.a, missing required architecture i386 in file PATH/libCorePlot-CocoaTouch.a (3 slices)
Undefined symbols for architecture i386:
"_CPTDecimalFromCGFloat", referenced from:
-[HomeViewController configureSecondPlots] in HomeViewController.o
-[HomeViewController configureSecondAxes] in HomeViewController.o
"_CPTDecimalFromInteger", referenced from:
-[HomeViewController configureSecondAxes] in HomeViewController.o
"_OBJC_CLASS_$_CPTAxisLabel", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTColor", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTFill", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTGraphHostingView", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTMutableLineStyle", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTMutableTextStyle", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTPieChart", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTPlotSymbol", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTScatterPlot", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTTextLayer", referenced from:
objc-class-ref in HomeViewController.o
"_OBJC_CLASS_$_CPTXYGraph", referenced from:
objc-class-ref in HomeViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix this problem?
Thank you
Combine both libraries and make a universal binary
lipo -create <simulator_lib>.a <device_lib>.a -output lib.a
Open the Core Plot iOS project (CorePlot-CocoaTouch.xcodeproj), update the architecture build settings to include 64-bit, and build the "Universal Library" target. This will create a folder called "Release-universal" in your build folder containing a universal library with all architectures (device and simulator) and copies of all of the header files.

Resources