realm-swift: No Such Module 'Realm' in Swift Project

Hello,

I downloaded Realm for iOS a few minutes ago (version 0.89.2), then I follow the installation guide:

  1. Drag the Realm.framework from ios folder to my project workspace and also copy it.
  2. Adding libc++.dylib to my project
  3. Drag and copy RLMSupport.swift

After that I did import Realm in my viewcontroller, then Xcode gave me No such module 'Realm' error message. I google this issue and I found this thread in SO. It said Version 0.86 is now out and this is no longer an issue.

So, why I’m still experiencing this issue even when I use version 0.89? Please help me 😃

p.s. I use Xcode 6.2 Beta

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 31 (8 by maintainers)

Most upvoted comments

Guys, for all that have such issue here is solution: After executing pod install, close XCode and open your project not from xcodeproj file, but from xcworkspace. Then build (Cmd+B). And POOF issue is gone!

I was using Cocoa Pods while I got this error, resolved this by adding $'inherited' to FRAMEWORK SEARCH PATH.

I am facing the same issue- I am using the installation commands for Cocoa as described in http://realm.io/docs/cocoa/0.90.1/, reproduced below-

In your Podfile, add pod “Realm” to your app target and pod “Realm.Headers” to your test target (see “Testing Realm Apps”) for details. From the command line, run pod install. Use the .xcworkspace file generated by CocoaPods to work on your project! Follow these additional steps if you use Swift: Download the latest release of Realm and extract the zip. Drag the file at Swift/RLMSupport.swift into the File Navigator of your Xcode project, checking the Copy items if needed checkbox.

Since I am using Swift, I followed the additional step and yes, I did check Copy items if needed and added it to the application target.

However, I am getting the following error during build- No such module “Realm” in import Realm in RLMSupport.swift file.

And I tried all the following steps without success-

“Clean” from Xcode (Shift+Cmd+K) “Clean Build Folder” from Xcode (Option+Shift+Command+K) Quit Xcode Delete the Derived Data directory (~/Library/Developer/Xcode/DerivedData) Launch Xcode and “Build”.

a) Using XCode6.1.1, Swift, Yosemite, iOS, Base SDK 8.1, Dep target: 7.0

@liweiz @bazscott @lum7671 we’ve updated our CocoaPods installation instructions for using Realm in Swift projects. Please let us know if you still run into issues after following them here: http://realm.io/docs/cocoa#installation.