You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
First, I would like to say that I'm new to objective-C world so I'm sorry if my question is too lame...
I'm currently trying to integrate this bridge into my C++ project and I have some issues targeting an iOS device.
What I've done is simple, I've just put the WebViewJavascriptBridge.* files to my project and compiled it with -x and objective-c++ flags.
On WebViewJavascriptBridge.h, I have a lot of semantic issue with WVJB_WEBVIEW_TYPE but after a quick search I found that adding the import of UIKit is enough to remove these errors.
But know, I have 12 semantic issues into WebViewJavascriptBridge.m with typeof and strongDelegate and I don't know how to fix that.
Do you have any idea of what can be the origin of these issues ? Did I do something wrong ?
Thanks for taking the time to try and write in with your problems. Sorry that WVJB is not working out as easily for you as it should be.
I have little experience working with cpp in objc projects, but let's start tackling this together and see where we get.
Here are some clarifications and some questions.
Re WVJB_WEBVIEW_TYPE: WebViewJavascriptBridge is built to work both for iOS and for OSX. However, the classname of webviews is different on iOS & OSX (WebView & UIWebView respectively). So we declare a macro variable which will replace "WVJB_WEBVIEW_TYPE" with the correct type at compilation time
Re typeof and strongDelegate: I need more information to know what's going on here. What are the warnings?
Are you building with xcode? If no, I would recommend starting by creating an iOS project in xcode and then integrate your cpp code.
For WVJB_WEBVIEW_TYPE, it's UIWebView for iOS but this type is defined in UIKit.h right ? You import WebKit.h OSX side, why don't you do the same thing for iOS ?
For typeof and strongDelegate, it's not warnings but errors. Xcode says that they are undeclared.
To answer to you, yes, I use Xcode 5 but the C++ project on which I work is a big framework that should compile on a lot of plateforms, including iOS. So I just can't create an Xcode project and import the C++ code into it.
Thanks again.
EDIT: Also, the iOS example available on the repository works pretty well, the problem really seems to be about the C++ integration.
I post a new message to notice you that I think I resolved the problem.
Finally, I start reading your code and I find out that all errors that I had were just after this section of the code:
/* Platform specific internals: OSX **********************************/
#elif defined WVJB_PLATFORM_IOS
I've check if it was the same thing on the main branch, but it's not. It's WVJB_PLATFORM_OSX instead of WVJB_PLATFORM_IOS so I made the change and it compile well.
This error is still into the 4.1.0 release.
Thanks for your help and sorry to ask my question before to read the entire code.
Ok, sorry again, It seems that I checked a little bit to quick... There is already an #if defined WVJB_PLATFORM_OSX so in the elif it's really WVJB_PLATFORM_IOS (the mistake was in comment).
So to return to the initial problem here are the errors that I encounter:
Like I said before it's about typeof and strongDelegate but strongDelegate is a variable defined using typeof so I think that the problem is only related to typeof keyword.
EDIT: I confirme that, if I replace all typeof by the type of _webViewDelegate (I put id), I can compile without error. But I don't know if it's the right way...
hi,
I try to use your code in unity3d Xcode project but i have a strange problem.
i have used unity3d 4.6.2 with Xcode 6.1.1 and she import your code in Xcode i have a error:
webViewDidStartLoad
2015-03-03 10:37:19.195 perceval[1355:1715745] -[__NSCFType countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x18913bf0
2015-03-03 10:37:19.196 perceval[1355:1715745] *** WebKit discarded an uncaught exception in the webView:didFinishLoadForFrame: delegate: -[__NSCFType countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x18913bf0
2015-03-03 10:37:22.363 perceval[1355:1715745] WVJB RCVD: {"data":"Hello from JS button","callbackId":"cb_1_1425375442341"}
2015-03-03 10:37:22.363 perceval[1355:1715745] ObjC received message from JS: Hello from JS button
2015-03-03 10:37:22.363 perceval[1355:1715745] -[__NSCFType addObject:]: unrecognized selector sent to instance 0x18913bf0
Activity
marcuswestin commentedon May 22, 2014
Hey @Noxalus,
Thanks for taking the time to try and write in with your problems. Sorry that WVJB is not working out as easily for you as it should be.
I have little experience working with cpp in objc projects, but let's start tackling this together and see where we get.
Here are some clarifications and some questions.
Cheers,
Marcus
Noxalus commentedon May 22, 2014
Thank you very much for your answer!
For WVJB_WEBVIEW_TYPE, it's UIWebView for iOS but this type is defined in UIKit.h right ? You import WebKit.h OSX side, why don't you do the same thing for iOS ?
For typeof and strongDelegate, it's not warnings but errors. Xcode says that they are undeclared.
To answer to you, yes, I use Xcode 5 but the C++ project on which I work is a big framework that should compile on a lot of plateforms, including iOS. So I just can't create an Xcode project and import the C++ code into it.
Thanks again.
EDIT: Also, the iOS example available on the repository works pretty well, the problem really seems to be about the C++ integration.
Noxalus commentedon May 23, 2014
I post a new message to notice you that I think I resolved the problem.
Finally, I start reading your code and I find out that all errors that I had were just after this section of the code:
I've check if it was the same thing on the main branch, but it's not. It's WVJB_PLATFORM_OSX instead of WVJB_PLATFORM_IOS so I made the change and it compile well.
This error is still into the 4.1.0 release.
Thanks for your help and sorry to ask my question before to read the entire code.
Have a nice day.
Noxalus commentedon May 23, 2014
Ok, sorry again, It seems that I checked a little bit to quick... There is already an
#if defined WVJB_PLATFORM_OSXso in the elif it's really WVJB_PLATFORM_IOS (the mistake was in comment).So to return to the initial problem here are the errors that I encounter:
Like I said before it's about typeof and strongDelegate but strongDelegate is a variable defined using typeof so I think that the problem is only related to typeof keyword.
EDIT: I confirme that, if I replace all typeof by the type of _webViewDelegate (I put id), I can compile without error. But I don't know if it's the right way...
Use explicit `WVJB_WEBVIEW_DELEGATE_TYPE` instead of inferred `typeof…
marcuswestin commentedon Aug 27, 2014
Hey, I finally patched this up in 5f10f81. Please let me know if it didn't fix your problem.
Cheers, and thanks again!
izzusan83 commentedon Mar 3, 2015
hi,
I try to use your code in unity3d Xcode project but i have a strange problem.
i have used unity3d 4.6.2 with Xcode 6.1.1 and she import your code in Xcode i have a error:
webViewDidStartLoad
2015-03-03 10:37:19.195 perceval[1355:1715745] -[__NSCFType countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x18913bf0
2015-03-03 10:37:19.196 perceval[1355:1715745] *** WebKit discarded an uncaught exception in the webView:didFinishLoadForFrame: delegate: -[__NSCFType countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x18913bf0
2015-03-03 10:37:22.363 perceval[1355:1715745] WVJB RCVD: {"data":"Hello from JS button","callbackId":"cb_1_1425375442341"}
2015-03-03 10:37:22.363 perceval[1355:1715745] ObjC received message from JS: Hello from JS button
2015-03-03 10:37:22.363 perceval[1355:1715745] -[__NSCFType addObject:]: unrecognized selector sent to instance 0x18913bf0
you have any idea?