I am trying to integrate iOS Native code to my Worklight application.
I Have created a Cordova plug-in with the below code:
HelloWorldPlugin.h
#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>
@interface HelloWorldPlugin : CDVPlugin
{
UINavigationController *navi;
}
-(void)sayHello:(CDVInvokedUrlCommand*)command;
HelloWorldPlugin.m is
-(void)sayHello:(CDVInvokedUrlCommand *)command
{
NSString *responseString=[NSString stringWithFormat:@"Hello........World %@",
[command.arguments objectAtIndex:0]];
CDVPluginResult *pluginResult=[CDVPluginResult
resultWithStatus:CDVCommandStatus_OK mes sageAsString:responseString];
[self.commandDelegate sendPluginResult:pluginResult
callbackId:command.callbackId];
}
The above code is working. Next, I have created a BarcodeScannerViewController Class. It contains: BarcodeScannerViewController.h, BarcodeScannerViewController.m and BarcodeScannerViewController.xib.
I need to call the BarcodeViewController so that the functionality of barcode should happen.
In above HelloWorldPlugin.m I have modified code as below to move to BarcodeScannerViewController
@implementation HelloWorldPlugin
-(void)sayHello:(CDVInvokedUrlCommand *)command
{
NSString *responseString=[NSString stringWithFormat:@"Hello........World %@",
[command.arguments objectAtIndex:0]];
CDVPluginResult *pluginResult=[CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsString:responseString];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
BarCodeScannerViewController *view=[[BarCodeScannerViewController alloc]init];
navi=[[UINavigationController alloc] initWithRootViewController:view];
}
But i am not able to move and getting log error as
2014-07-11 10:06:23.660 HelloWorld[548:60b] THREAD WARNING:
['HelloWorldPlugin'] took
'214928.292969' ms. Plugin should use a background thread.
2014-07-11 10:06:23.666 HelloWorld[548:4207] void SendDelegateMessage(NSInvocation *):
delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:)
failed
to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode