Realm-cocoa: Realm/RLMArray.h file not found and Could not build Objective-C module 'Realm'

Created on 11 May 2016  路  29Comments  路  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

Error on line 21 of Realm.h Realm/RLMArray.h file not found and Could not build Objective-C module 'Realm'

Steps to Reproduce

Add RealmSwift to podfile and run pod install

Version of Realm and Tooling

Realm version: 0.102.0

Xcode version: 7.3.1

iOS/OSX version: 8.0

Cocoapods version: 1.0

T-Help

Most helpful comment

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.

All 29 comments

Hi @BarlowTucker,

Thanks for opening an issue. I tried adding RealmSwift using CocoaPods to a new iOS project using a configuration identical to yours, and wasn't immediately able to reproduce the bug.

  • Is RealmSwift the only pod in your project, or are there other pods as well?
  • Have you tried cleaning the build folder and deleting the project's derived data?

If you are willing to send over the project itself, I'd also be happy to look at it directly. Let me know if you have any questions or concerns.

If cleaning the build folder and deleting derived data don't work, you can also try clearing the CocoaPods cache and reinstalling your pods:

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

I got the same error, tried the solution above, still not working.

My Podfile:

source 'https://github.com/CocoaPods/Specs'

platform :ios, '8.0'
use_frameworks!

target 'myapp' do
    pod 'RxSwift', '~> 2.0'
    pod 'RxCocoa', '~> 2.0'
    pod 'Moya'
    pod 'Moya/RxSwift'
    pod 'ObjectMapper'
    pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
    pod 'RealmSwift'
    pod 'RxRealm'
    pod 'SnapKit'
    pod 'CocoaLumberjack/Swift'
    pod 'TLYShyNavBar'
end

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.

Some additional info:

I have been using Realm with Cocoapods 0.39 for a couple months with no problem. With the release of Cocoapods 1.0 I am now seeing this error.

I have tried:

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

I have removed RealmSwift from my cocoapod, run pod install added RealmSwift back into the podfile and run pod install again. Nothing seems to make any kind of difference for me. I still get the Realm/RLMArray.h file not found message.

I have verfied that that file does exist and is included in the Headers group in the project. Not sure what the problem is.

Let me know if there is any additional information that I can get you that would be helpful.

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.

@BarlowTucker: Confirmed. It fixed it for me too.

Only clean build folder is not working for me. I have to clear CocoaPods cache first, then Clean Build Folder... and do the pod install.

It looks like the issue is resolved. I'll look into adding a bit about troubleshooting basic CocoaPod issues to our documentation. In the meantime, if you run into further problems please feel free to open a new ticket!

@BarlowTucker It worked for me.I cleanthe folder,and do the pod install

@BarlowTucker This one is work for me.. thank you

worked for me too

@BarlowTucker Thank you a lot. it works for me. 馃憤

Cleaning Derived data folder, pod install and clean/rebuild did the job to me. It's working now... except for the part of the deprecated constructor for ReamConfiguration not having the path property anymore... that one I consider it my bad.

Clean Build Folder it works for me!

Clean Build Folder worked!!!!!

@BarlowTucker ,Thanks!!!!

thanks @austinzheng 馃憤 either cleaning the derived data folder or the pods cache fixed it for me!

Clean Build Folder worked!!!!!

delete derived data worked for me

Clean Build Folder worked for me as well.

+1 Worked for me

Deleted Derived Data Worked!

Deleted Derived Data Worked! +1

Deleted Derived Data Worked for me as well! +1

"Clean Build Folder" worked for me as well... thank you!

"Clean Build Folder" worked, thank you 馃憤

@BarlowTucker I love you man. You saved my day and my tomorrow as well!

'Realm/Realm.h' file not found and Could not build Objective-C module 'Realm' if you have any solution plz help me

@PreetidhankarIOS, please stop commenting on long-closed issues. If you're having a problem with Realm, please file a new GitHub issue and provide the requested information.

Was this page helpful?
0 / 5 - 0 ratings