-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cedar, Swift and Protocol Declarations - Compiler error #397
Comments
How is your WKNavigationDelegate declared? And if it is in an ObjC header, On Mon, Sep 12, 2016 at 9:56 AM, Manu Kanthan notifications@github.com
|
I've declared it on MyViewController - MyViewController.swift (same file I posted above). It is not in an Objective-C header anywhere. So, declaring it and running my main app target with the following compiles and runs fine (displays the log message some time after I execute
However, with this same code, my Specs target does not even compile and gives me an error in my autogenerated -Swift.h file. If I were to remove the In case you want to see my bridging header (Specs-Bridging-Header.h), it's here:
Importing WebKit.h here should be enough, correct? Edit: Forgot to add that I set the delegate in |
@akitchen I fixed this issue - it seems I was missing an import in Specs-Prefix.pch. I added this line to Specs-Prefix.pch:
I think I can consider this issue closed. However, it's a bit of a mystery to me why it wasn't until I introduced the delegate that it stopped compiling. It was fine with WKWebView which is another WebKit framework class. |
Thank you for the update! Glad to hear you got things resolved. I wonder if this had anything to do with the ancestry of your protocol declaration. We have definitely seen weird quirks around protocol loading/discovery in the past.
|
I and you the same, I finally know how to solve, thank you very much!!!!!! |
I am also struggle in same thing @mkanthan answer help me. thankyou |
I'm having a similar issue (not with Cedar specifically, but re: protocols not being found). Has anyone found anything more about the underlying issue, e.g. why importing to the prefix header helped? Specifically, I'm trying to use a Swift protocol (declared in a Development Pod) on a Swift class (in my main project, which is mixed ObjC and Swift). I get the same issue as above, where in the Thanks in advance if anyone has pointers! |
I'm running into a compilation error when introducing a WKNavigationDelegate into my view controller.
My project config: I'm using Cedar in the "stand-alone" setup, with a separate Specs target. I have not been able to get Swift specs working properly (although this is probably a different issue). However, I can write Objective-C specs for Swift modules. So for now, my Spec files are all in Objective-C, and my main target is a mix of Swift and Objective-C which compiles and runs fine (with the correct bridging headers). I should add that my project is an older project started with Cedar/Objective-C from a while ago, so I'm not sure if there's other config that I'm lacking. I'm running Cedar 0.13.1.
Everything compiles and runs fine when my code is the following:
MyViewController.swift:
MyViewControllerSpec.mm:
Things start to go awry when I introduce the WKNavigationDelegate:
Running my Specs target, I get a compiler error inside my auto-generated Swift header (My_App-Swift.h):
On this line, I get the compiler error
Cannot find protocol declaration for 'WKNavigationDelegate'; did you mean 'UINavigationBarDelegate'?
. Obviously, I didn't mean UINavigationBarDelegate. But I'm not sure what I'm missing - I've done the necessary imports of UIKit, and WebKit in the Spec file, as well as the bridging header.FYI, my main target compiles and runs fine, and I'm able to set up the delegate, etc. I'm stumped here.
The text was updated successfully, but these errors were encountered: