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).
@dasdom sorry for the delay in getting back to you. Could you please verify that your FRAMEWORK_SEARCH_PATHS in Xcode are correct and include the path to the OS X version of Realm.framework (and that they _don't_ include the path to the iOS framework)?
I'm having the same issue when Realm is added via cocoapods, even though I followed the steps in the documentation:
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.
This is the error I'm getting:

My Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
inhibit_all_warnings!
pod 'Realm', '0.89.2'
The swift support file is there:

Let me know if I can provide more information.
I was able to reproduce this issue. It happens because the generated umbrella header imports some of the underlying private headers on first install, which is not supposed to happen. It seems like this is an issue with the Realm.podspec in combination with the executed prepare_command, which only appears for integration with frameworks.
@dasdom @ldiqual: For now, you should be able to workaround the issue by just running pod install again.
@mrackwitz Ran pod install twice but it didn't fix the issue. I'll wait on https://github.com/realm/realm-cocoa/pull/1358/files to be merged.
Just curious: when will the podspec be updated on cocoapods and what's the underlying process behind the push?
@segiddins Sorry for the late reply I was busy with other stuff. I have update to 0.90.1 and checked again. The Problem remains. The Framework Search Path points to the OS X Realm framework.
I'm not using cocoapods. I installed Realm following the steps in Manual Installation.
@dasdom in an effort to not conflate the distinct issues discussed in this thread, could you provide steps to reproduce the problem you're facing? Are you saying that following the "Manual Installation" steps listed here for an iOS Objective-C app yields a compilation error "error: could not build Objective-C module 'Realm'"?
@jpsim No, sorry, I'm talking about a command line Swift OS X application which I use to populate my realm database. I followed the manual installation steps you linked in your comment (http://realm.io/docs/cocoa/0.90.2/#installation).
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.
+1 @Legoless
@Legoless @pkalinowski: Sorry for my late response here. Have you tried meanwhile to update to the latest version of Realm and the latest prerelease of CocoaPods? This should fix this issue.
Hey, guys. I had some similar issues. The problem was that when CI server is a windows machine, and the build nodes are macs, in the process of server side checkout, it messed up line endings.
It's worth to check if you're using different OS in the process of building something.
@rKrums: Good to keep in mind. Thanks for bringing to attention here!
@rKrums "check if you're using different OS in the process of building something " how to check?
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.
I have to create a new project and everything's fine.Seems some problems
with my build settings.
On Thu, May 12, 2016 at 11:25 PM, Christian Howland <
[email protected]> wrote:
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.—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
https://github.com/realm/realm-cocoa/issues/1280#issuecomment-218792416
Hi,
Error adding Realm to a Swift project - "Umbrella header 'Realm.h' not found"
from here
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.
It was working for me (latest version of Pods and Realm, Xcode 8, Swift 3) but then I moved the part of my project that uses Realm to a separate framework (target), modified my podfile accordingly and now I get this error.
Please file a new issue, providing all of the details requested in the new issue template, rather than commenting on an issue that's been closed since January of last year.
Most helpful comment
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.