I am integrating 3rd party libraries into my project using cocoapods. Everything was working smoothly but when i try to integrate facebook ios sdk I encounter a very strange issue, my pods project has the following warning:
If i click on it i get the following dialog:
I checked the Headers in the build phases part of the target "Pods-Facebook-iOS-SDK". Every header file is repeating:
When i try to build my project it fails because it is not able to find "FacebookSDK/FacebookSDK.h".
My last option is to just integrate facebook sdk manually and not use cocoapods for it but I dont want to take that route and for the life of me I cannot understand what I am doing wrong. For refrence following is my pod file:
platform :ios, '7.0'
pod 'DTCoreText'
pod 'UIView+AnimationExtensions'
pod 'EZAudio'
pod 'MZTimerLabel'
pod 'AWSAutoScaling'
pod 'AWSCloudWatch'
pod 'AWSCore'
pod 'AWSDynamoDB'
pod 'AWSEC2'
pod 'AWSElasticLoadBalancing'
pod 'AWSKinesis'
pod 'AWSS3'
pod 'AWSSES'
pod 'AWSSNS'
pod 'AWSSQS'
pod 'AWSSimpleDB'
pod 'Facebook-iOS-SDK'
Following is the information regarding my developement environment:
XCode: 6.1
Architectures: armv7, arm64
Base SDK: iOS 8.1
I was having a similar problem. My project previously had not used Cocoapods and I was now attempting to add the Facebook SDK via Cocapods.
Based on #MingLi's comment, I replaced all instances of #import <FacebookSDK/FacebookSDK.h> with #import <FBSDKCoreKit/FBSDKCoreKit.h> and things started working again.
When I compiled in Xcode, it showed me files that need #import <FBSDKLoginKit/FBSDKLoginKit.h> and #import <FBSDKShareKit/FBSDKShareKit.h>
You will also likely have to go through and adjust things that changed between Facebook SDK 3.x and 4.x. For instance, I had to replace [FBSettings setDefaultAppId:123456789] with [FBSDKSettings appId:123456789] and replace [FBAppEvent activateApp] with [FBSDKAppEvents activateApp].
Xcode is sometimes helpful about finding the needed change, if you compile and then click the red dot (in your code) next to each compile error.
It can take a good bit of work to sort through all of the changes, you may have to recompile many times.
If you are having problems figuring out how to replace specific functions/classes when upgrading from SDK 3.x to 4.x, you can refer to Facebook's Change Log:
https://developers.facebook.com/docs/ios/change-log-4.x
You can also find additional information here:
https://developers.facebook.com/docs/ios/getting-started
Related
I am doing Objective-C in iOS app. But the problem is I want to add few Objective-C apis into that I added successfully earlier with cocoa pods, But, now I want to add Swift Api through cocoa pods, but the problem getting while installing is following.
[!] Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pods being used are: apis
But I can't add this manually due to its large api and it contains sub folders.
But, if I remove "#" key from use_frameworks!, its getting installed, but, the old Objective-C apis getting file not found in my project.
Even I have very basic knowledge at installing frameworks/apis through cocoa pods.
Can any one suggest me how to over come this.
use_frameworks! will work with Objective-C pod only if they are dynamic frameworks not static libraries. Most of the popular third party libraries are using dynamic frameworks like AFNetworking, GoogleMaps etc.
Make sure all your Objective-C pods are dynamic frameworks. If you are not sure just create a sample project with cocoapods and use use_frameworks!. Try adding one by one, all the pods and find out which one is the culprit.
I had that problem once, what I did was use use_frameworks! like you mentioned, and then I changed how the Objective-C imports are written.
The command use_frameworks! turns each pod into a Framework, so in your projects the .h and .m files are no longer visible to the import like they would usually.
As a result, instead of using for example #import <AFNetworking/AFNetworking.h>, you do #import AFNetworking;
From my own experience, and maybe it was just a special case for my project. But turning everything into frameworks slowed down the compile time on Xcode and it made my App Package bigger for some reason.
Podfile file:
platform :ios, '10.0'
use_frameworks!
def pods
pod 'Alamofire', '= 4.4'
pod 'SwiftyJSON' '= 3.1.4'
pod 'MBProgressHUD'
end
target 'YourProject' do
pods
end
YourProject-Bridging-Header.h
#import <MBProgressHUD/MBProgressHUD.h>
Build Settings
I'm following this tutorial to put Google Ad on my page: https://firebase.google.com/docs/admob/ios/quick-start
At the step:
GADMobileAds.configureWithApplicationID("ca-app-pub-8123415297019784~8909888406");
And the error occurred:
AppDelegate.swift:58:9: Type 'GADMobileAds' has no member 'configureWithApplicationID'
And after the checking, i see there is no member configureWithApplicationID.
What's wrong with this instruction?
And why i have to install Firebase/Core in this version?
Here are methods in GADMobileAds, there is no configureWithApplicationID like Objective C version. How stupid is that http://i.imgur.com/Od0vkPg.png
Remove the cocoapods line from the instruction and replace with this line:
pod 'Google-Mobile-Ads-SDK'
It will install the google sdk version 7.9.0 and you'll see the configureWithApplicationID method. This is the error from Google for Swift.
Xcode 7.3, iOS9.3.3
Followed the instructions above, but wanted to expand, in hopes of saving someone time. If you had 'Google-Mobile-Ads-SDK' pod already installed, then check the version to make sure it is 7.9.0+. Otherwise, you will keep installing the old version over and over.
To update the version, follow the instruction taken from Cocoapods website https://cocoapods.org/pods/Google-Mobile-Ads-SDK click "Installation Guide" (bottom right):
The '~> 7.9' bit will force an update.
What I had that did not work:
What it needs to be:
Again, note the version is 7.9.1
The Podfile looks like this:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'AppName' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for AppName
pod 'Firebase'
pod 'Google-Mobile-Ads-SDK', '~> 7.9'
target 'AppNameTests' do
inherit! :search_paths
# Pods for testing
end
end
Now you will be able to configure GADMobileAds with the Google prescribed method:
[GADMobileAds configureWithApplicationID:#""];
Or the Swift equivalent:
GADMobileAds.configureWithApplicationID("");
Hope this helps! Cheers.
Try to update Podfile to the following:
#pod 'Firebase/AdMob'
pod 'Google-Mobile-Ads-SDK'
I recently tried to update my pod to pod 'Google-Mobile-Ads-SDK', '~> 7.9' and it did not work for me. Because I already had a version of Google-Mobile-Ads-SDK in my file, I simply needed to run pod update. The problem was that Google has updated the SDK beyond 7.9 and updating versus naming a specific version ensures you get the latest one.
The instructions in the Google documentation are ok. I was running into the same issue with CocoaPods installing the old version. Use the Cocoa Pods update command and it fetches the latest version of Admob and the error goes away.
I see it right here in GADMobileAds.h. Check to see if you have the most up to date version.
//
// GADMobileAds.h
// Google Mobile Ads SDK
//
// Copyright 2015 Google Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#interface GADMobileAds : NSObject
/// Returns the shared GADMobileAds instance.
+ (GADMobileAds *)sharedInstance;
/// Configures the SDK using the settings associated with the given application ID.
+ (void)configureWithApplicationID:(NSString *)applicationID;
SOLUTION
ok so while the suggested answer helped to find a solution, this required some work. So I will describe my recipy if that helps.
My compilation problem was probably due to a mismatch between frameworks versions. While some frameworks were injected manually, some others were added using pods. This might have caused the problem and my project wasn't compiling for all simulators.
To overcome this, I deleted all residual frameworks and added them back using pods. However, this was not plug and play. Im using xcode 6.3.x (working with Swift 1) and there were semantic issues while using updated pods.
here is my working recipy:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'GoogleMaps'
pod 'Parse', '1.9.1'
pod 'ParseUI'
pod 'ParseFacebookUtilsV4', '~> 1.9'
pod 'ParseTwitterUtils', '~> 1.9'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
full project is now compiling for all simulators.
QUESTION
I was working on an app which was building for all simulators until I added pods in order to integrate Google Maps SDK. Using this framwork, in addition to Parse SDK, required to add Facebook SDK and some libs. this was the starting point of my problem as there was a conflict with the -ObjC flag
Since then, my project is building fine for most simulator, except for iphone 4S, iphone 5 and some ipads. The returned error is the following:
Library compilation and build architectures are really new so I was wondering if this was only a simulator issue or if my problem would persist when building .api ? I would need to ensure everything would work as expected on devices going from iphone 4S to 6+
my valid architecture are the following: arm64 armv7 armv7s
Could someone guide me toward the understanding of what's happening?
I would be really happy to provide any additional information you may require to help me. Thanks you!
The Parse framework that you include in the project is built for 64 bit MacOSX.
I suggest you add Parse pods to your Podfile
pod 'Parse'
pod 'ParseUI'
pod 'ParseCrashReporting'
Using a Podfile like so:
platform :ios, '8.1'
source 'https://github.com/CocoaPods/Specs.git'
pod 'AWSiOSSDKv2'
I am getting a bunch of "file not found" errors in my xcode project related to the #imports being used in the AWSSDK. E.g. in AWSMobileAnalyticsContext.h:
#import "configuration/AWSMobileAnalyticsConfiguring.h"
I suspect this has to do with the fact that the project hasn't been updated with a dynamic framework output in mind (which is what the beta of cocoapods is using). I've gone through and actually tried hand-updating the paths to these imports, and I can clear most of the file not found errors, but then it starts complaining about the Mantle.h import elsewhere.
Anybody successfully gotten the AWSiOSSDKv2 to work with an app by using the cocoapods beta (or even a forked version that uses dynamic frameworks)?
I was able to get it to work today.
I deleted all traces of cocoapods since it had originally been installed using 0.35.
[project].xcworkspace
All mentions in [project].xcodeproj related to pods (yes, by hand with vim)
Pods/
Podfile and Podfile.lock
I then installed my swift pods using carthage instead. For me, this was Alamofire and SwiftyJSON.
I made a commit here, so I could easily go back to this point.
My podfile was just this, I could not get it to work with the use_frameworks! line.
target 'WhatsLegal' do
pod 'AWSiOSSDKv2'
pod 'Facebook-iOS-SDK'
end
I ran pod init and then pod install, and it started working from here!
Xcode 6 beta is recognizing Parse but not PFFacebookUtils when i am trying to initialize both in appdelegate.m
here is how i am doing the integration of Facebook SDK
i am using cocoa pods to add parse and Facebook to iOS project. i am using Xcode 6 beta.
i create pod file this way
platform :ios, '8.0'
pod 'Parse'
i run pod install at terminal and this downloads parse and Facebook SDK
Now i import parse in appdelegate.m
using
#import <Parse/Parse.h>
With v1.2.21 of the Parse library, PFFacebookUtils.h has moved into another Framework, ParseFacebookUtils. Xcode isn't recognising PFFacebookUtils.h because it most likely doesn't exist anymore.
You need to add the ParseFacebookUtils pod to your Podfile:
pod 'ParseFacebookUtils', '~> 1.2'
BUT, there is an issue with this. The Parse pod spec lists Facebook-iOS-SDK v3.17 as a dependency, and the ParseFacebookUtils spec lists an alternative Parse podspec (Parse-iOS) as well as Facebook-iOS-SDK v3.9.0 as a dependency, which is obviously a conflict. You don't need 2x parse libraries, and incompatible versions of the Facebook SDK floating around.
I've forked and updated a version of the ParseFacebookUtils spec on github, that solves both these problems. If you'd like to use it add the following to your podfile:
pod 'ParseFacebookUtils', :podspec => 'https://raw.githubusercontent.com/rickerbh/ParseFacebookUtilsSpec/master/ParseFacebookUtils.podspec.json'
And be sure to
#import <ParseFacebookUtils/PFFacebookUtils.h>
as well so your project knows about PFFacebookUtils