We have a mixed code base in our WatchKit extension. In a couple of Objective-C files, we need access to the Swift code base from the extension. We've been using the following import:
#import "MyProject_WatchKit_Extension-Swift.h"
This has worked fine for the entire dev process.
I am in the process of moving to Xcode 6.3. After updating our code base to Swift 1.2, I'm getting File not found
for my extension-swift file.
What I've tried:
Anybody have any thoughts.
It seems Xcode has changed it's default behaviour for file paths defined in the target's build settings. Previously it was happy to look recursively for a file within the project directory, so you could just define the file name and you were good to go. Now you need to prepend the folder name.
Go to your targets build settings and search for 'Objective-C Bridging Header', you'll probably see the entry 'MyProject_WatchKit_Extension-Swift.h'. You need to prepend the path to the file relative to the root project folder.
If your folder was structured as so:
PROJECT_ROOT_FOLDER
- CLASSES_FOLDER
-- MyProject_WatchKit_Extension-Swift.h
- .xcodeproj
- TESTS_FOLDER
Then you would need to change the value to
CLASSES_FOLDER/MyProject_WatchKit_Extension-Swift.h
I was able to figure out the answer by editing the Objective-C Generated Interface Header Name
field in the extension's build settings. I had never previously edited this field, and I'm not sure how the value was removed. I'll leave this here in case others have the same problem:
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.