Realm-cocoa: Umbrella header 'Realm.h' not found

Created on 11 May 2016  路  31Comments  路  Source: realm/realm-cocoa

Goals

Install Realm using Cocoapods 1.0

Expected Results

I expect it to install and work as per the instructions on https://realm.io/docs/swift/latest/

Actual Results

Umbrella header 'Realm.h' not found

Steps to Reproduce

Add Realm to podfile, run pod install and build project

I tried to clean Pods with
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

From pods realm project file, it looks like it's failing to set Realm.h header as public in Pods.xcodeproj, so it's failing to build module map.

Code Sample

platform :osx, "10.10"

inhibit_all_warnings!
use_frameworks!

target 'Project' do

pod 'CocoaLumberjack'

pod 'Sparkle'
pod 'HockeySDK-Mac'

pod 'Realm'

pod 'AFNetworking'
pod 'AFNetworkActivityLogger'

end

Version of Realm and Tooling

Realm version: 0.102.0

Xcode version: 7.3.1

iOS/OSX version: 10.11.4 (15E65)

Cocoapods version: 1.0

T-Help

Most helpful comment

@BarlowTucker's solution above actually worked for me after running the following:

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

It took the combination of the two to get it to compile for me.

All 31 comments

I can't reproduce this using the same configuration of tools you have here. Could you please try the following and share the console output?

pod cache clean Realm
pod cache clean RealmSwift
pod deintegrate || rm -rf Pods
pod install --verbose

Preparing

Analyzing dependencies

Inspecting targets to integrate
Using ARCHS setting to build architectures of target Pods-Beam: (``)

Finding Podfile changes

  • AFNetworkActivityLogger
  • AFNetworking
  • CocoaLumberjack
  • HockeySDK-Mac
  • Realm
  • Sparkle

Resolving dependencies of Podfile

Comparing resolved specification to the sandbox manifest
A AFNetworkActivityLogger
A AFNetworking
A CocoaLumberjack
A HockeySDK-Mac
A Realm
A Sparkle

Downloading dependencies

-> Installing AFNetworkActivityLogger (2.0.4)

Copying AFNetworkActivityLogger from
/Users/lukasfoldyna/Library/Caches/CocoaPods/Pods/Release/AFNetworkActivityLogger/2.0.4-12148 to
Pods/AFNetworkActivityLogger

-> Installing AFNetworking (2.6.3)

Copying AFNetworking from /Users/lukasfoldyna/Library/Caches/CocoaPods/Pods/Release/AFNetworking/2.6.3-cb8d1 to
Pods/AFNetworking

-> Installing CocoaLumberjack (2.3.0)

Copying CocoaLumberjack from /Users/lukasfoldyna/Library/Caches/CocoaPods/Pods/Release/CocoaLumberjack/2.3.0-97fab to
Pods/CocoaLumberjack

-> Installing HockeySDK-Mac (4.0.0)

Copying HockeySDK-Mac from /Users/lukasfoldyna/Library/Caches/CocoaPods/Pods/Release/HockeySDK-Mac/4.0.0-5a44b to
Pods/HockeySDK-Mac

-> Installing Realm (0.102.0)

Git download
Git download
$ /usr/bin/git clone https://github.com/realm/realm-cocoa.git
/var/folders/72/6rxhcc7d7f339ksq12f9qdbm0000gn/T/d20160511-16450-cvn3p1 --template= --single-branch --depth 1 --branch
v0.102.0
Cloning into '/var/folders/72/6rxhcc7d7f339ksq12f9qdbm0000gn/T/d20160511-16450-cvn3p1'...
Note: checking out 'ff7abdf7249238a7cf689755827355cee48dfc7d'.

 You are in 'detached HEAD' state. You can look around, make experimental
 changes and commit them, and you can discard any commits you make in this
 state without impacting any branches by performing another checkout.

 If you want to create a new branch to retain commits you create, you may
 do so (now or later) by using -b with the checkout command again. Example:

   git checkout -b <new-branch-name>

Running prepare command
$ /bin/bash -c set -e sh build.sh cocoapods-setup
core is not a symlink. Deleting...
Downloading dependency: core 0.100.2
Installing for Xcode 7+.
Copying Realm from /Users/lukasfoldyna/Library/Caches/CocoaPods/Pods/Release/Realm/0.102.0-5d219 to Pods/Realm

-> Installing Sparkle (1.14.0)

Copying Sparkle from /Users/lukasfoldyna/Library/Caches/CocoaPods/Pods/Release/Sparkle/1.14.0-ccd95 to Pods/Sparkle

  • Running pre install hooks

Generating Pods project

  • Creating Pods project
  • Adding source files to Pods project
  • Adding frameworks to Pods project
  • Adding libraries to Pods project
  • Adding resources to Pods project
  • Linking headers
  • Installing targets

    • Installing target AFNetworkActivityLogger OS X 10.8

    • Generating Info.plist file at Pods/Target Support Files/AFNetworkActivityLogger/Info.plist

    • Generating module map file at Pods/Target Support Files/AFNetworkActivityLogger/AFNetworkActivityLogger.modulemap

    • Generating umbrella header at Pods/Target Support Files/AFNetworkActivityLogger/AFNetworkActivityLogger-umbrella.h

    • Installing target AFNetworking OS X 10.9

    • Generating Info.plist file at Pods/Target Support Files/AFNetworking/Info.plist

    • Generating module map file at Pods/Target Support Files/AFNetworking/AFNetworking.modulemap

    • Generating umbrella header at Pods/Target Support Files/AFNetworking/AFNetworking-umbrella.h

    • Installing target CocoaLumberjack OS X 10.7

    • Generating Info.plist file at Pods/Target Support Files/CocoaLumberjack/Info.plist

    • Copying module map file to Pods/Target Support Files/CocoaLumberjack/CocoaLumberjack.modulemap

    • Installing target Realm OS X 10.9

    • Generating Info.plist file at Pods/Target Support Files/Realm/Info.plist

    • Copying module map file to Pods/Target Support Files/Realm/Realm.modulemap

    • Installing target Pods-Beam OS X 10.10

    • Generating Info.plist file at Pods/Target Support Files/Pods-Beam/Info.plist

    • Generating module map file at Pods/Target Support Files/Pods-Beam/Pods-Beam.modulemap

    • Generating umbrella header at Pods/Target Support Files/Pods-Beam/Pods-Beam-umbrella.h

  • Running post install hooks
  • Writing Xcode project file to Pods/Pods.xcodeproj

    • Generating deterministic UUIDs

  • Writing Lockfile in Podfile.lock
  • Writing Manifest in Pods/Manifest.lock

Integrating client project

Integrating target Pods-Beam (Beam.xcodeproj project)
Adding Build Phase '馃摝 Embed Pods Frameworks' to project.
Adding Build Phase '馃摝 Copy Pods Resources' to project.
Adding Build Phase '馃摝 Check Pods Manifest.lock' to project.

  • Running post install hooks

    • cocoapods-stats from /usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-stats-1.0.0/lib/cocoapods_plugin.rb

Sending stats
- AFNetworkActivityLogger, 2.0.4
- AFNetworking, 2.6.3
- CocoaLumberjack, 2.3.0
- HockeySDK-Mac, 4.0.0
- Realm, 0.102.0
- Sparkle, 1.14.0
Pod installation complete! There are 6 dependencies from the Podfile and 6 total pods installed.

Looks like there may have been some changes in the last few CocoaPods 1.0 RC's that actually broke Realm support in some cases, I'm hunting down exactly what those are for now, or if I'm doing something wrong, because I think I was able to reproduce this. I'll keep you posted.

I had a similar issue and was able to resolve it by cleaning the build folder.
(Hold down option while clicking Product in the Xcode menu shows the Clean Build Folder... option)

I hope that helps.

I'm also having this issue. Cleaning build folder didn't help.

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target 'My-App' do

    pod 'Alamofire', '~> 3.3'
    pod 'AlamofireObjectMapper', '~> 3.0'
    pod 'XLPagerTabStrip'
    pod 'Kingfisher'
    pod 'DZNEmptyDataSet'
    pod 'RealmSwift'

end

@BarlowTucker Thanks, but it didn't work.

@BarlowTucker's solution above actually worked for me after running the following:

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

It took the combination of the two to get it to compile for me.

@skrenek That worked for me. Thanks to you and @BarlowTucker!!

@skrenek Sadly, it's not helping me.

Failed for me. I tried all steps and now I'm stucked at this error:

:1:9: note: in file included from :1:

import "Headers/Realm.h"

    ^

/Users/Dani/Library/Developer/Xcode/DerivedData/knowme-drqtcphcunmzfeaaclhycxcqpvny/Build/Products/Debug-iphonesimulator/Realm/Realm.framework/Headers/Realm.h:21:9: error: 'Realm/RLMArray.h' file not found

import

    ^

:0: error: could not build Objective-C module 'Realm'
:2:9: note: in file included from :2:

import "Headers/RealmSwift-Swift.h"

Xcode: Version 7.3.1 (7D1014)
cocoapods (1.0.0)
cocoapods-core (1.0.0)
cocoapods-deintegrate (1.0.0)
cocoapods-downloader (1.0.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.0.0)
cocoapods-try (1.0.0)

@drieran Temporary fix is to change all Realm headers in Pods project Realm directory to public in side panel.

Sorry I'm trying to copy but probably at wrong place. Can you tell me source folder and destination ?

@drieran Just go to realm folder in Pods select all .h from Realm and change it to public

screen shot 2016-05-13 at 11 03 15

screen shot 2016-05-13 at 11 04 05

No way :(

realm h 2016-05-13 11-30-03
rlmarray h 2016-05-13 11-30-35

As mentioned @BarlowTucker Finally, I solved doing that:

So, I am a little ashamed that I didn't try this earlier, but it appears that if I run Clean Build Folder... (Hold down option while clicking Product in the Xcode menu shows the Clean Build Folder... option) it fixes the issue for me.

OS X

We could determine, that there is an actual issue with CocoaPods 1.0, but this is limited to OS X targets. We track this by #3570.

iOS, watchOS, tvOS

If you're building on another platform, please make sure to follow the steps as proposed by @jpsim as seen here:

pod cache clean Realm
pod cache clean RealmSwift
pod deintegrate || rm -rf Pods
pod install --verbose

Please don't forget to clean your build folder as explained by @drieran in the comment directly above:

Hold down option while clicking Product in the Xcode menu shows the Clean Build Folder... option

Note: This can be also achieved via the key shortcut 鈱モ嚙鈱楰.

+1 same issue... using Xcode Version 7.3 (7D175).

Try to clean, reintegrate, remove all Pods, reinstall, ...

Unable to make RealmSwift work if I'm using Cocoapods 1.0...

Using pod _0.39.0_ install, fix the issue but it's not really a solution..

platform :ios, '8.0'
use_frameworks!

target 'XXX' do
  pod 'RealmSwift', '~> 0.98'

  target 'XXXTests' do
    inherit! :search_paths
  end

  target 'XXXUITests' do
    inherit! :search_paths
  end
end

I'm still having a similar issue using cocoapods 1.0.1 and the latest version of RealmSwift. Moving the headers to public doesn't seem to fix the issue for me though.

Confirmed, still having the same issue on cocoapods 1.0.1, building for iOS.

@collinsmwade @diego-watanabe please file new issues with full steps to reproduce after following the recommendations from our docs.

Same issue on Cocoapods 1.0.1. Doing this do nothing:

pod cache clean Realm
pod cache clean RealmSwift
pod deintegrate || rm -rf Pods
pod install --verbose
rm -rf ~/Library/Developer/Xcode/DerivedData

The only fix I found is to downgrade to Cocoapod 0.39.0. Not the best, but it works..

@PhilippeBoisney could you please file new issues with full steps to reproduce?

All of the solutions above do not work for me. After trying and trying, I finally found that it is the problem of "User Header Search Paths". At first my user header search paths are $(PODS_ROOT) recursive, which includes Realm锛孯ealSwift and other third-party frameworks. But if I leave the user header search paths empty, it can not work too because other third-party frameworks need it. So I just add other third-party frameworks(except for Realm and RealmSwift) into the user header search paths. Just like that:
2016-07-23 11 24 21
Now it works! :)

Did anyone open a new issue for this problem? If so, I'm not seeing it. I saw it today, and changing the header search paths entry for Realm to recursive was the solution. I definitely believe this to be an upgrade issue, since the project I was working on hadn't been touched since 2014. (Although it's of course possible it's a cocoapods issue, not a Realm issue.)

Same problem. Made all possible updates/cleans. No luck.
In the end made manual installation w/o cocoapods.

@Kirow please file a new issue, taking care to fill out the new issue template so we have enough information to look into this for you.

All my code in project is written by Objective C, and I install a new library which written by Swift (via cocoa pod), then got the same. I try to remove and install again, then it worked. Maybe Realm-Objective-C conflict with Swift library.

i stuck with this error for about a month, none of the above solution works for me! can anyone help me?

@BarlowTucker's solution above actually worked for me after running the following:

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

It took the combination of the two to get it to compile for me.

it didnt work for me!

@BarlowTucker's solution above actually worked for me after running the following:

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

It took the combination of the two to get it to compile for me.

This work for me

I solved this problem by switching build system:

Open File -> Xcode Workspace Settings
Switch Build System to "Legacy Build System".

Was this page helpful?
0 / 5 - 0 ratings