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.
Related
I get No such module 'BRLMPrinterKit' error.
I take a reference from official document https://support.brother.com/g/s/es/htmldoc/mobilesdk/guide/getting-started/getting-started-ios.html to import framework.
Here is my step:
drag BRLMPrinterKit.framework and BRLMPrinterKitW.framework into my framework folder
Check they are in Link Binary With Libraries (remove and drag again)
Check Framework Search Paths (I'm not sure it correct or not)
Check Header Search Paths (I'm not sure it correct or not)
Finally I clean and build get No such module 'BRLMPrinterKit' error.
I have no idea how to fix my import problem, any help would be appreciated. Thanks.
That's not a Swift module, so first, you need to create a bridging header, in which you import <BRLMPrinterKit/BRLMPrinterKit.h>, then you can use the BRLM classes in your Swift files.
Try using CocoaPods to install the framework, it's more convenient and faster.
Your framework supports installation using cocoapods
https://cocoapods.org/
https://github.com/jonathantribouharet/BRLMPrinterKit
using CocoaPods to install the 'BRLMPrinterKit' framework.
add the bridge file.(Targets > Build Settings > Swift Compiler - General > Objective-C Bridgeing Header)
the bridge file.h
#ifndef PtouchPrinterKit_Bridging_Header_h
#define PtouchPrinterKit_Bridging_Header_h
#import <BRLMPrinterKit/BRPtouchBluetoothManager.h>
#import <BRLMPrinterKit/BRPtouchDeviceInfo.h>
#import <BRLMPrinterKit/BRPtouchNetworkManager.h>
#import <BRLMPrinterKit/BRPtouchPrinter.h>
#import <BRLMPrinterKit/BRPtouchPrinterData.h>
#import <BRLMPrinterKit/BRPtouchPrinterKit.h>
#import <BRLMPrinterKit/BRPtouchPrintInfo.h>
#endif
then you can use the framework
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've been trying to integrate GCM into my existing iOS project via Cocoapods. Upon building, I've been having compilation errors complaining about "#import errors..." with "...modules disabled". I do have modules enabled, except that the issue is happening since I have a mix of .m and .mm (Objective-C++) files where modules are not supported (this has already been raised by others).
I'm able to suppress the error in some files using the preprocessor flag "GMP_NO_MODULES" that's provided (e.g. in GGLInstanceID.h)
#if GMP_NO_MODULES
#import <Foundation/Foundation.h>
#else
#import Foundation;
#endif
but other required header files (e.g. GGLConfiguration.h) do not have the flag built-in.
Did anyone find any short-term solutions around this?
I don't think there is any way to fix this right now since there are internal files that do not seem to respect this flag. Although GCM folks are going to come up with an update to the library very soon, that should fix this.
Why not adding GMP_NO_MODULES=1 in your Project or Target Preprocessor Macros?
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
First I want to note, I've read this and have used it before and my question is different:
How to call Objective-C code from Swift
I'm trying to use this library in Swift.
This library uses OCMock and when I try to compile, I get 'OCMock/OCMock.h' file not found at the line #import <OCMock/OCMock.h>. Here's how I normally fix it, but this time, it's not working.
Just like every other Obj-C library in Swift, I added it to my bridge header, which I already had made and am using for others:
#import "JSQMessages.h"
#import "JSQMessageData.h"
I then added $(PROJECT_DIR) to my Header Search Paths.
Here is the file structure.
From the project directory, it should look for OCMock/OCMock.h, and it is there, as seen in screenshot. So why isn't it working?
I just created a fresh swift iOS project, add JSQMessage using CocoaPod(http://cocoapods.org). No error. try following:
1. Create a new project
2. Create a podfile and add
pod 'JSQMessagesViewController'
3. Create a bridge header and add
#import <JSQMessagesViewController/JSQMessages.h> // import all the things
3. Run
pod install
4. Open project.xcworkspace and build it