Giter Site home page Giter Site logo

Comments (6)

marcuswestin avatar marcuswestin commented on June 2, 2024

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.

  • 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.

Cheers,
Marcus

from webviewjavascriptbridge.

Noxalus avatar Noxalus commented on June 2, 2024

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.

from webviewjavascriptbridge.

Noxalus avatar Noxalus commented on June 2, 2024

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.

Have a nice day.

from webviewjavascriptbridge.

Noxalus avatar Noxalus commented on June 2, 2024

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:

alt Error

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...

from webviewjavascriptbridge.

marcuswestin avatar marcuswestin commented on June 2, 2024

Hey, I finally patched this up in 5f10f81. Please let me know if it didn't fix your problem.

Cheers, and thanks again!

from webviewjavascriptbridge.

izzusan83 avatar izzusan83 commented on June 2, 2024

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?

  • Thansk a lot.

from webviewjavascriptbridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.