'Google/Analytics.h' file not found - XCode 7 - xcode

I am having much trouble integrating Google Analytics SDK into my iOS project. I am using XCode 7 and targeting iOS 7. Using Swift 2.0. However I can get the sample working ok (not converting to Swift 2.0 though).
I've tried both install via CocoaPods and by copying the files manually from:
https://developers.google.com/analytics/devguides/collection/ios/v3/sdk-download
When installing via CocoaPods I've tried both
pod 'Google/Analytics'
,
pod 'GoogleAnalytics'
and
pod 'Google/Analytics', '~> 1.0.0'
Either case the XCode build fails with error
BridgingHeader.h:2:9: 'Google/Analytics.h' file not found
Failed to import bridging header '/Users/jonas.andersson/Projects/MyAppName/MyAppName/Supporting files/BridgingHeader.h'
This on row:
#import <Google/Analytics.h>
I've also tried to add
$(SRCROOT)/Pods/GoogleAnalytics
and the rest of the suggestions from Google/Analytics.h file not found when adding to AppDelegate
Update
Using pod 'GoogleAnalytics' and then #import <Google/Analytics.h> worked better. However then I get the following error:
Use of unresolved identifier 'GGLContext'
when I try setup GA from according to Google documentation:
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)

Solved it by going away from Googles own tutorial and not use GGLContext and importing headers directly.
My podfile:
platform :ios, ’7.0’
use_frameworks!
pod 'GoogleAnalytics'
And BridgingHeader.h:
#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIFields.h"
And setup:
let gai = GAI.sharedInstance()
let id = "my-GA-id"
gai.trackerWithTrackingId(id)
gai.trackUncaughtExceptions = true
gai.logger.logLevel = GAILogLevel.Verbose
Also added to User Header Search Paths:
$(SRCROOT)/Pods/GoogleAnalytics (recursive)

#import <GoogleAnalytics/GAI.h>
Instead of:
#import <GoogleAnalytics.h>
This what worked for me, XCODE9.0.

Related

How do I avoid build errors when I include SQLCipher pod in Swift project?

I am using sqlite.swift
When I include this in my pod file:
pod 'SQLite.swift/SQLCipher', '~> 0.12.2'
Is SQLCipher still compatible with SQLite.swift?
Do I need additional pod statements to import SQLCipher and SQLite or just this one line?
XCode reports error when I build that look like this:
/Pods/SQLCipher/sqlite3.h:6907:10: Redefinition of 'sqlite3_index_orderby'
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/include/sqlite3.h:6758:10: Previous definition is here
Pods/SQLite.swift/Sources/SQLiteObjc/include/SQLiteObjc.h:26:9: While building module 'SQLite3' imported from /Library/Developer/Xcode/DerivedData/SpeechCollector-btdxklvmapneuigwvexrhccrhodq/Build/Products/Debug-iphonesimulator/SQLite.swift/SQLite.framework/Headers/SQLiteObjc.h:26:
/:2:9: In file included from :2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/include/sqlite3ext.h:20:10: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/include/sqlite3ext.h:20:
We had the same issue on our project, and we couldn't update to the next Xcode until this was solved.
The repo SQLite.swift looks abandoned, but among the pull requests there's this one that resolved the issue for our project.
What we did is download the repo and added it as a local dependency (we are using Cocoapods), then we added the changes that appear in that PR.
In file SQLiteObjc.h, we changed from
#import Foundation;
#if defined(SQLITE_SWIFT_STANDALONE)
#import sqlite3;
#else
#import SQLite3;
#endif
to
#import Foundation;
#if defined(SQLITE_SWIFT_STANDALONE)
#import sqlite3;
#elif defined(SQLITE_SWIFT_SQLCIPHER)
#import SQLCipher;
#else
#import SQLite3;
#endif
Hope this helps to you also.

Bootstrap 4 beta using rubygem doesn't work with Jekyll

I just start using Jekyll recently for my personal project.
I'm using Jekyll-assets together with gem 'bootstrap-sass'; and everything works with charm.
This is what my main.css.scss look like:
#import '_sass/variables';
#import '_sass/scaffolding';
#import 'bootstrap-sprockets';
#import 'bootstrap';
#import 'font-awesome-sprockets';
#import 'font-awesome';
Everything works when I run jekyll serve.
However, when I try to use the latest beta version,
I got this error when I try to run Jekyll Serve
Incremental build: disabled. Enable with --incremental
Generating...
Error in _assets/css/main.scss:7 File to import not found or unreadable: bootstrap.
Load paths:
/Users/MacBookPro/.rvm/gems/ruby-2.3.0/gems/font-awesome-sass-4.7.0/assets/stylesheets
/Users/MacBookPro/.rvm/gems/ruby-2.3.0/gems/font-awesome-sass-4.7.0/assets/fonts
I commented out the #import 'bootstrap-sprockets.
It seems that Jekyll-assets does not found the bootstrap path.
I've already follow the step-by-step guide as stated in the documentation at [https://github.com/twbs/bootstrap-rubygem][1]
Currently I'm not using any package manager such as npm,yarn etc. Any help?

Cannot find module FBSDKCoreKit Cocoapods

I'm trying to integrate facebook into my app using CocoaPods, using the use_frameworks! tag, and according to facebook's instructions here, also included the pod bolts. When I try use import FBSDKCoreKit in my appdelegate, I get a no such module 'FBSDKCoreKit error. I've included my podfile below:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.2'
use_frameworks!
pod 'Bolts'
pod 'Alamofire', '~> 3.0'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
Additionally, in my Pods folder, there is a question mark next to Bolts, FBSDKCoreKit, and FBSDKSharekit, but not one next to alamofire, which I had been using previously. In the Frameworks folder in my Pods project, FBSDKCoreKit and Bolts are listed there, but are both red.
Any ideas? I've tried cleaning my project, and reinstalling and updating the pods.
For people moving from Carthage to Cocoapods make sure to remove the Carthage references of the FBSDKCoreKit from the Link Binary With Libraries under Build Phases option.
Please try below steps,
Explicitly mention the versions i.e.
pod 'FBSDKCoreKit', '~>5.8.0'
pod 'FBSDKShareKit', '~>5.8.0'
pod 'FBSDKLoginKit', '~>5.8.0'
Update pod repo using sudo pod repo update
Update pod using pod update
Seems that the facebook pods are Objective-C and they need a special way of importing in a swift project.
This is how I got it to work:
Create a bridging header in your project, if you dont have one(I created a new header file called Bridging-Header.h and set it as a bridging header in the project settings, like in the screenshot)
Then in this file import the facebook modules. Here's how my file looks like:
#ifndef Bridging_Header_h
#define Bridging_Header_h
#import FBSDKCoreKit;
#import FBSDKLoginKit;
#endif /* Bridging_Header_h */
Let me know if this workout for you or you need more help.
I fixed this by
Removing the Bridging Header. Facebook SDK doesn't need them anymore after version 4.1
Adding all of the .frameworks to the Projects Build Phases -> Link Binary With Libraries
Selecting each framework and building it. You can do this by selecting your project name next to the run arrow.
Cleaning the project and restarting my computer.
Very simple solution, if you are using Apple Swift Packages:
Go to Navigator pane and select the project
Then make sure you choose project name under "Project" not under "Targets"
Then select Package Dependencies tab
You will find the Facebook package there, double click on it
Change version to 9.0.0 and click "Done"
Rebuild, and it should be corrected.
Note that you may need this url to add Facebook SDK as Apple Swift Packages rather than Cocoapods.
You can try :
pod 'FBSDKCoreKit/Swift'
first add in pod file
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
this is facebook swift library,after that before using FBSDKCoreKit,just use FacebookCore then import FBSDKCoreKit

How to install ConvenienceKit Framework via Podfile Swift

I've tried multiple methods and Xcode versions to install this method and use it but every time when i use import ConvenienceKit it always fails by saying "No such module ConvenienceKit"
https://github.com/MakeSchool/ConvenienceKit
it can be installed by using use_frameworks! in the Podfile and pod 'ConvenienceKit'. Everything installs fine, just doesn't work.
What am i missing ?
To use pods use have to work in a 'workspace' with the the pod that you are using. If you are using a workspace and it is sill not working you can try the following:
Check to see if there is a update for CocoaPods
Check to see if there is a update for Xcode
Uninstall Xcode and re install it.
Hope this works.

Using CocoaPods with Swift

I'm new to Cocoapods and am trying to use a pod named DateTools in my OS X app Swift project.
I installed Cocoapods, created the podfile, added pod 'DateTools' to it, ran pod install and everything seemed to work fine. (I'm a Ruby dev so I think I got this part right).
As asked by Cocoapods, I now opened my project using the new .xcworkspace file created. I correctly see two projects in Xcode: mine and Pods.
I added a sample model file to my project, let's call it SampleModel but in the code, when I do this:
let date = NSDate()
var year = date.year
I get the error: 'NSDate' does not have a member named 'year'. According to DateTools README, this should work.
As I'm new to both Xcode and Cocoapods, I can't figure out what is the likely error: DateTools not working with Swift or did I fail to import something, somewhere?
You need to import module into your source file
import DateTools
Also, by default is CocoaPods building static libraries - to use those you would need to configure bridging header. Easier way is to make it build dynamic framework by specifying so in Podfile (and run pod install):
use_frameworks!
pod 'DateTools'

Resources