This has actually been driving me crazy.
I've been following the instructions on the Google Developer's site (which doesn't actually have an import line, but if you inspect the element you can kinda notice that someone messed up and it's supposed to be #import <Google/Analytics.h>)
But Xcode just refuses to find the Google Analytics, while it imports the other header in my bridging header perfectly alright (e.g. it reads the file fine, but only does one of the imports).
My file looks like this:
#import <workinglibrary.h>
#import <Google/Analytics.h> // this doesn't work!
I've tried every variation of <Analytics.h> or "Google/Analytics.h" and so on. My header search paths looks fine too:
"${PODS_ROOT}/Headers/Public/Google"
"${PODS_ROOT}/Headers/Public/Google/Google"
"${PODS_ROOT}/Headers/Public/GoogleAnalytics"
...
Final caveat: I'm not sure (since Xcode doesn't fully build when I do this), but I think that Xcode properly imports the Analytics.h file if I comment out the #import <workinglibrary.h> statement (at least, I can Apple + Click analytics functions in other files to get to their declaration).
EDIT: just kidding that last bit isn't true
I had same issue. This has been fixed in cocoapods 0.38.2
To update use: gem install cocoapods
You can use_frameworks!
Seems like for the latest stable Swift/XCode/Cocoapods/GA it needs putting #import <GoogleAnalytics/GAI.h> into bridging header
Related
I installed HTMLKit via pods.
Everything went well and I am able to see it loaded.
Unfortunately, when I try to build the project, it fails telling me that it couldn't find a specific header.
This is how I import the pod in my file:
#import "../../../Pods/HTMLKit/Sources/HTMLParser.m"
I am no expert in objective c so I am not sure if that's correct. One thing that is weird is that I always imported header files, but this time it seems that I need to import an .m file?
If I try to import the header file of that, it simply says that the header is not found (although, as always it's there in the folder).
I am not sure how to fix it. I've seen some answers here on SO but they all use a different version of xcode so I am not sure what to do.
Try #import <>
And if it show you something automatically I think it will work.
Again, Not “”. Use <>.
Goal: Be able to use swift pods in an ObjC project
Steps Taken:
Altered Podfile by appending use_frameworks!
Ran pod install (Cocoapods version 1.0.0)
Built workspace again
Result (Errors):
I get the following Realm.io errors (pod installed from pod 'Realm' since I'm coding in ObjC):
RLMRealm.h:51:1: Duplicate interface definition for class 'RLMRealm'
RLMRealm.h:95:62: Property has a previous declaration
RLMRealm.h:105:38: Property has a previous declaration
RLMRealm.h:110:56: Property has a previous declaration
RLMRealm.h:115:38: Property has a previous declaration
RLMRealm.h:297:28: Property has a previous declaration
RLMRealm.h:493:1: Duplicate interface definition for class 'RLMNotificationToken'
Problem-Solving Steps Taken:
(Previous ones in edit history that led to this simplified question)
Deleted all pods and reinstalled (no effect)
Unlinked Pods framework in Build Phases and relinked (no effect)
Cleaned and built / Cleaned build folder and built (no effect)
Tried importing with "", <>, and #import (currently all imports in my code are done with #import <Realm/Realm.h>) (searched with #import <Realm and #import "Realm) (no effect)
Created new project, copied files over, and pod installed (no effect)
Searched project folder for "#interface RLMNotificationToken" and only found one instance of the RLMRealm.h file, so I don't have duplicates
Deleting all of my files except for AppDelegate.h/m builds successfully
Searched for #import "R, #import <R, #import R and found a rogue #import <RLMRealm.h>
Questions:
I'm frankly really confused and not sure what to do at this point.
So how do I fix these build errors? Why is this happening? Or what other problem-solving steps should I try? (Answers to any of these questions would be appreciated)
Evidently one of my files had a #import <RLMRealm.h> in it (not sure how that got in there). I changed that to #import Realm; and it all works now. I missed that when searching before and only found it while combing my code. Interesting that it works with the library but not with the framework. Well, figured it out and it's all good now.
Realm pod for swift is "RealmSwift". I think you are using objective-c pod.
Have a look at this link Realm for Swift. You can also drag and drop realm framework, this will save from errors you have been facing.
Please check all places, where you import Realm classes. In my case I imported #import <RLMArray.h>. Should be #import <Realm/RLMArray.h>
I'm writing an iOS App using Parse.com to interact with a server.
I've downloaded and installed the SKD, added all frameworks correctly and everything works fine until it comes to the PFQueryTableViewController. It doesn't appear in the drop down list when I'm creating a new class and I can't create one programmatically because Xcode just doesn't know it.
Same with a PFImageView, is this somehow related?
The SKD should be up to date since I updated it yesterday including the local datastore.
Am I missing here something?
Thanks in advance!
For anyone using swift having this issue. In your bridging header file make sure you have the following:
#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
#import <ParseUI/ParseUI.h>
There are two possibilities:
You do not have the Frameworks compiling properly. Make sure the Frameworks are properly installed by following the instructions here: https://parse.com/apps/quickstart#parse_data/mobile/ios/native/existing
The Xcode UI is not seeing the class properly to add it for subclassing - not a big deal. Get around it by starting the creation of a new class, then when you get to the naming page, simply start typing in the 'Subclass of:' box the name PFQueryTableViewController and it should autocomplete, as seen in this screenshot:
UPDATE:
You may also want to check your 'Link Binary with Libraries' under 'Build Settings'. Be sure that the Parse.framework and Bolts.framework files are listed.
Finally taking on pods. Everything seems to work, for example, dropped in Parse, install pod'd, see it in a view controller.m file just fine.
BUT.. now i want to drop Parse into the pch as i use it so often. My pre-pods line was:
#import "Parse/Parse.h"
I tried this, and
#import <Parse/Parse.h>
and
#import <Parse.h>
.. and every variant i can think of, no luck. I can of course drop imports where required, but this is more convenient, despite the suggestions not to use this route.
What i find most confusing is that the UI pre-fills in the path for me for second option, so it finds it, but on build, it fails with
'Parse/Parse.h' file not found.
Thanks for suggesting a working syntax.
This may not be the perfect answer, as there are so my cocoapods fans using the repo that this is likely due to my newness to it, but i had to manually create an entry into User Header Search Paths which was "Pods" and set it recursive.
Then all was good.
I'm attempting to getting the Amazon iOS SDK integrated into my application and using the cocoapod to install it.
However, it won't compile, I'm getting an error inside of AmazonS3Client.h that says
'AWKRuntime/AmazonWebServiceClient.h' file not found
but it is clearly there in the Pod when I search for it.
Anyone else had this issue?
Note: This answer refers to a now deprecated version of the AWS SDK for iOS.
I ran into the same problem when migrating a project to CocoaPods. Without modifying any of the AWS header files, I was able to avoid by changing my header import lines from:
#import <AWSS3/AWSS3.h>
#import <AWSSNS/AWSSNS.h>
to:
#import <AmazonS3Client.h>
#import <AmazonSNSClient.h>
This works because all that AWSS3.h does is #define AWS_MULTI_FRAMEWORK and then #import "AmazonSNSClient.h", and AWS_MULTI_FRAMEWORK is responsible for the other header files expecting a different directory structure than what CocoaPods sets up.
To find out what file names you need to include, just look inside the AWS*.h file you were importing and then import the files named inside directly.
When using the cocoapod for AWS it has this in the separate framework headers:
#ifndef AWS_MULTI_FRAMEWORK
#define AWS_MULTI_FRAMEWORK
#endif
That makes it look to other frameworks instead of the relative path for the headers for shared frameworks.
If you comment those lines out, it will work.