简体   繁体   中英

Objective C iOS project + Swift 2 WatchOS project with Cocoapods

I've got an Objective-C project , and I recently added a WatchOS 2 project to it which is in Swift 2.

From WatchOS project ,I'm accessing an Objective-C class (lets just say Equations.m ) via a bridging header. However this Equations.m file imports another library (to be specific HHUnitConverter ) and this HHUnitConverter was added to the project using Cocoapods.

When I build the WatchOS project I'm getting this error : " HHUnitConverter.h " is not found.

Isn't it possible to use an Objective-C class via a bridging-header in a Swift class, when that Obj C class has references to another Obj-C classes that were added using cocoapods? What should I change to make this file available to the compiler?

I've been tearing my hair out trying to get this working for hours, any advice is appreciated. Thanks!

Select your watchOS target and go to Build Settings. Set the 'Objective-C Bridging Header' file to the same file as in your iOS target.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM