Reputation: 1460
Goal: Be able to use swift pods in an ObjC project
Steps Taken:
Podfile
by appending use_frameworks!
pod install
(Cocoapods version 1.0.0)Result (Errors):
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:
""
, <>
, and @import
(currently all imports in my code are done with #import <Realm/Realm.h>
) (searched with #import <Realm
and #import "Realm
) (no effect)"@interface RLMNotificationToken"
and only found one instance of the RLMRealm.h
file, so I don't have duplicatesAppDelegate.h/m
builds successfully#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)
Upvotes: 3
Views: 480
Reputation: 1053
Please check all places, where you import Realm classes. In my case I imported #import <RLMArray.h>
. Should be #import <Realm/RLMArray.h>
Upvotes: 0
Reputation: 1460
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.
Upvotes: 2
Reputation: 1248
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.
Upvotes: 1