Skip to content
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

Using WebViewJavascriptBridge in existing storyboard UIWebView #28

Closed
kagster opened this issue Nov 28, 2012 · 5 comments
Closed

Using WebViewJavascriptBridge in existing storyboard UIWebView #28

kagster opened this issue Nov 28, 2012 · 5 comments

Comments

@kagster
Copy link

kagster commented Nov 28, 2012

Hi,

I ran the example code for iPhone 5.1 Simulator and everything works fine.

I'm using Xcode 4.4 with the storyboard and I already have a UIWebView. I pasted this code from the example usage into the viewDidLoad event

WebViewJavascriptBridge* bridge = [WebViewJavascriptBridge bridgeForWebView:webView handler:^(id data, WVJBResponse* response) {
NSLog(@"Received message from javascript: %@", data);
[response respondWith:@"Right back atcha"];
// or [response respondWithError:]
}];

but got this error "no known class for selector 'bridgeForWebView'

Did I do something wrong or can I not use it in the manner? Any suggestion on how to use this appropriately in my case?

Thanks for your help,
Kalvin

@marcuswestin
Copy link
Owner

Hi Kalvin,

I'm getting married Sunday and am in the thick of things :) will be happy to help this time of next week if your remind me but in the meantime I'll have to defer to other contributors and the source code. Please ping them if you are in a rush. Sorry!

Cheers,
Marcus

-- while mobile

On Nov 28, 2012, at 2:28 PM, kagster notifications@github.com wrote:

Hi,

I ran the example code for iPhone 5.1 Simulator and everything works fine.

I'm using Xcode 4.4 with the storyboard and I already have a UIWebView. I pasted this code from the example usage into the viewDidLoad event

WebViewJavascriptBridge* bridge = [WebViewJavascriptBridge bridgeForWebView:webView handler:^(id data, WVJBResponse* response) {
NSLog(@"Received message from javascript: %@", data);
[response respondWith:@"Right back atcha"];
// or [response respondWithError:]
}];

but got this error "no known class for selector 'bridgeForWebView'

Did I do something wrong or can I not use it in the manner? Any suggestion on how to use this appropriately in my case?

Thanks for your help,
Kalvin


Reply to this email directly or view it on GitHub.

@pj4533
Copy link
Contributor

pj4533 commented Nov 29, 2012

👍 Congrats Marcus!

@marcuswestin
Copy link
Owner

Thanks PJ :)

-- while mobile

On Nov 29, 2012, at 3:48 PM, PJ Gray notifications@github.com wrote:

Congrats Marcus!


Reply to this email directly or view it on GitHub.

@marcuswestin
Copy link
Owner

@kagster, remember to #import "WebViewJavascriptBridge.h" first!

I just made some changes to the API, so if you haven't started using WVJB yet update it and then do:

#import "WebViewJavascriptBridge.h"

...

WebViewJavascriptBridge* bridge = [WebViewJavascriptBridge bridgeForWebView:webView handler:^(id data, WVJBResponseCallback responseCallback) {
    NSLog(@"Received message from javascript: %@", data);
    responseCallback(@"Right back atcha");
}];

@kagster
Copy link
Author

kagster commented Dec 10, 2012

Marcus,

Thanks for the update. I will test it and let you know.

Kalvin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants