realm-swift: error: could not build Objective-C module 'Realm'

I try to build a Mac command line tool to fill a realm database I’d like to use in a iOS app. I followed the instructions to add the Realm framework to the Mac app.

When I build directly after I have deleted the build folder everything works. When I then change something in a file which imports the Realm module I get the following error:

error: could not build Objective-C module 'Realm'
import Realm
       ^

I’m using Swift.

Deleting the build folder works but it’s far from perfect. Am I missing something?

This does not happen in my iOS project (as far as I can tell).

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

I was getting this same error. I tried clearing derived data, cleaning, and running pod install again but no luck. I then tried updating Cocoapods itself and repeating those steps, but got the same error. I also tried pod update but it didn’t help.

Finally, I tried deleting my whole ‘Pods’ folder, ran pod install, cleared derived data, cleaned, and then the error went away.

Hi, Error adding Realm to a Swift project - “Umbrella header ‘Realm.h’ not found” from here

  1. Aliases.swift:20:8: Could not build Objective-C module ‘Realm’
  2. module.modulemap:2:21: Umbrella header ‘Realm.h’ not found I algo got this error, installed realm the first time, v.0.93.2, XCode 6.3.2

I have a multitarget project (OSX/iOS) and I’m using a bridging header for both.

This is my podfile:

def shared
    use_frameworks!
    pod 'Alamofire', '~> 1.2'
    pod 'Valet', '~> 1.3'
    pod 'RealmSwift'
end

target ‘myproj_osx' do
    platform :osx, '10.10'
    shared
end

target 'myproj_ios’ do
    platform :ios, '8.0'
    pod 'WYPopoverController', '~> 0.2.2'
    shared
end

target 'myproj_tests' do
    platform :osx, '10.10'
    shared
    pod 'Quick', '~> 0.3.0'
    pod 'Nimble', '~> 0.4.0'

end

Before adding realm everything was working…

The same issue in my project,when I change swift2.2 convert to swift2.3.

I’m having the same issue, this is my Podfile:

platform :ios, '8.0'

inhibit_all_warnings!
use_frameworks!

target 'MyApp' do
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'Alamofire'
  pod 'AlamofireObjectMapper'
  pod 'Moya'
  pod 'Moya-ObjectMapper'
  pod 'Firebase'
  pod 'OAStackView'
  pod 'RealmSwift'
  pod 'MMDrawerController'
  pod 'UIColor_Hex_Swift'
end
/Build/Intermediates/Pods.build/Debug-iphoneos/Realm.build/module.modulemap:2:21: error: umbrella header 'Realm.h' not found
    umbrella header "Realm.h"
                    ^
/Pods/RealmSwift/RealmSwift/Aliases.swift:20:8: error: could not build Objective-C module 'Realm'
import Realm

Edit: Issue is related to CocoaPods 1.0.0-beta.