I can't use Realm with Swift.
target 'RealmSwiftTest' do
pod 'Realm'
end
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RLMRealm", referenced from:
__TMaCSo8RLMRealm in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Version of Realm (latest from CocoaPods) , Xcode 6.3 (6D520o), Mac OS X 10.10.2 (14C109)
#import <Realm/Realm.h>import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
println(RLMRealm.defaultRealm())
}
...
Any clue?
I also tested with the latest version of Swift/RLMSupport.swift and it gives me the error:
No such module 'Realm'.
Are you adding #import <Realm/Realm.h> to your bridging header?
Yes, I added #import <Realm/Realm.h> and gives me the same error on import Realm (No such module 'Realm').
If I remove import Realm it gives me:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RLMArray", referenced from:
__TMaCSo8RLMArray in RLMSupport.o
_protocol_conformances in RLMSupport.o
"_OBJC_CLASS_$_RLMObject", referenced from:
__TFFE16CocoaPodKeysTestCSo8RLMArray8generateFS0_FT_GVSs11GeneratorOfCSo9RLMObject_U_FT_GSqS2__ in RLMSupport.o
__TMaCSo9RLMObject in RLMSupport.o
__TFFE16CocoaPodKeysTestCSo10RLMResults8generateFS0_FT_GVSs11GeneratorOfCSo9RLMObject_U_FT_GSqS2__ in RLMSupport.o
"_OBJC_CLASS_$_RLMRealm", referenced from:
__TMaCSo8RLMRealm in ViewController.o
"_OBJC_CLASS_$_RLMResults", referenced from:
__TMaCSo10RLMResults in RLMSupport.o
_protocol_conformances in RLMSupport.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Yes, you'll need to remove the import Realm (since you aren't integrating it as a framework, and thus it isn't a module). As to the other issues, I'm not quite sure what's going on. Maybe @mrackwitz has some ideas?
Hi @ricardopereira, please follow these instructions to use Realm in a CocoaPods Swift project:
[sudo] gem install cocoapods --pre).use_frameworks! and pod 'Realm' to your app target, and pod 'Realm/Headers' to your test target.pod install..xcworkspace file generated by CocoaPods to work on your project!Swift/RLMSupport.swift into the File Navigator of yourWe'll be updating our installation instructions on http://realm.io shortly.
@jpsim i got an issue when i run my project on iphone 6 and 6+. It works fine on other devices. Why do i get this error and how can I fix it? Thanks
@neon0619 please open a new GitHub issue along with steps that we can follow to reproduce the issue you're seeing. This happens when the linker can't find the symbols referred to by the headers/interface provided by the framework.