Using WebViewJavascriptBridge in existing storyboard UIWebView #28

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

Comments

Projects
None yet
3 participants

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

Owner

marcuswestin commented Nov 29, 2012

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.

Contributor

pj4533 commented Nov 29, 2012

👍 Congrats Marcus!

Owner

marcuswestin commented Nov 29, 2012

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.

Owner

marcuswestin commented Dec 9, 2012

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