New developer here, and I'm currently building an app in swift. We are using cocoapods, but after running pod install, we get an error in the objective-c bridging header saying that the file cannot be found, but for any and every file in our bridging header. For example, we use DateTools. We pod install it, in the bridging header we put:
#import <DateTools/DateTools.h>
but then, upon running, it errors, saying that 'Datetools/Datetools.h' file not found
. I've already looked through a lot of other similar posts (like this, this, or this), but none have solved the issue. Any help would be greatly appreciated!
Asked
Active
Viewed 1,896 times
2

Community
- 1
- 1

Michael Eliot
- 831
- 8
- 18
-
Make sure that you use frameworks and instead of importing it into the brdging header, why not try just doing a plain `import` at the top of your class instead? – Jesse Onolemen Oct 15 '16 at 22:12
-
In the podfile, we do have use_frameworks!. When I remove the bridging header, it errors at the import and says something like `No such module "Parse"` – Michael Eliot Oct 16 '16 at 00:13
-
with pods we dont use bridging headers at all – David Seek Oct 16 '16 at 00:27
-
the whole joke behind pods is, that we don't have to bridge the headers, since cocoapods does the this work for us – David Seek Oct 16 '16 at 00:28
-
thanks for the accept. i have upvoted your question. hope you're getting your code working. good luck with your project – David Seek Oct 16 '16 at 02:40
-
also i have answered your other question – David Seek Oct 16 '16 at 02:47
-
No thank you man. Code is working great, but I'm learning firebase right now so I will be asking many more questions haha – Michael Eliot Oct 16 '16 at 02:51
-
okay dude. always glad to help. but let me tell you. it is important that you upvote AND accept answers. people are investing their time here and here is everything about upvotes and accepts... – David Seek Oct 16 '16 at 02:55
-
just telling you, because you are new – David Seek Oct 16 '16 at 02:55
-
I actually did, but I didn't have the 15 prestige necessary for it to show. Just got my 15th, so happy to upvote. – Michael Eliot Oct 16 '16 at 03:16
1 Answers
5
When using the use_frameworks
! instruction in Cocoapods, the bridging header is not required for importing Objective-C pods in Swift.
Simply set your desired pods into your podfile:
#Uncomment this line to define a global platform for your project
platform :ios, '9.0'
#Uncomment this line if you're using Swift
use_frameworks!
target 'YourProject' do
#Swift Pods
pod 'Alamofire'
pod 'ActiveLabel'
#ObjC Pods
pod 'IDMPhotoBrowser'
pod 'Firebase'
#This stuff is to set the SWIFT_VERSION
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
end
Run pod install
. Run pod update
(should not be necessary, but for some reason I'm getting updates almost every time, even after clean install). Close Xcode and reopen using the white xcworkspace
file.
import Alamofire
import ActiveLabel
import IDMPhotoBrowser
import Firebase
Done.

David Seek
- 16,783
- 19
- 105
- 136