git地址:http://git.oschina.net/feiji1hao/NZOCJSBridgegit
項目是爲混合開發提供Objective-C與Javascript通訊的中間件api
只需將目錄NZOCJSBridge拷貝到本身項目中,項目中自帶Demo,使用前請熟悉例子spa
爲方便閱讀與使用,只提供兩個主要的api,有須要可自行擴展.net
1、oc向js發送消息並回調code
[_bridge send:@"OC send String to JS" responseCallback:^(id response) { NSLog(@"OC got response: %@", response); }];
2、js向oc發送消息並回調
orm
bridge.send('JS send String to OC', function(responseData) { console.log('JS got response', responseData) })
注:此項目爲WebViewJavascriptBridge的縮略版中間件