I'm loading an application (via embedded framework) via a PhoneGap Plugin.
Now, I'm trying to pass the current UIViewController to the parentViewController property of the FlashizFacade object.
When I execute my application I'm getting this error in the debug console when assigning self:
2012-09-10 13:01:43.663 gTicketSales[2805:16a03] -[FlashizPlugin navigationController]: unrecognized selector sent to instance 0x91925e0
2012-09-10 13:01:43.665 gTicketSales[2805:16a03] ***WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate:
<NSInvalidArgumentException>
-[FlashizPlugin navigationController]: unrecognized selector sent to instance 0x91925e0
When assigning self.viewController:
2012-09-10 14:31:21.455 gTicketSales[3693:16a03] ***WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate:
<Wrong parentViewController specified>
When using non-modal display, parentViewController have to be an instance of UIViewController with a valid navigationController assigned
I've tried:
facade.parentViewController = self;
facade.parentViewController = self.viewController;
#import <Cordova/CDVPlugin.h>
#import <FlashizPaymentLib/FlashizFacade.h>
@interface FlashizPlugin : CDVPlugin <FlashizPaymentDelegate> {}
@property (nonatomic, retain) FlashizFacade* flashizFacade;
- (void) openFlashiz:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
@end
#import "FlashizPlugin.h"
@implementation FlashizPlugin
@synthesize flashizFacade;
- (void) openFlashiz:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
NSLog(@"Flashiz Payment Opening...");
NSString *callbackId = [arguments pop];
NSString *invoiceId = [arguments objectAtIndex:0];
FlashizFacade* facade = [[FlashizFacade alloc] initWithEnvironment:FE_TEST];
facade.parentViewController = self;
facade.delegate = self;
self.flashizFacade = facade;
[facade executePaymentForInvoiceId:invoiceId];
[facade release];
CDVPluginResult *result;
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Flashiz Payment Executed..."];
[self writeJavascript:[result toSuccessCallbackString:callbackId]];
}
@end
Thanks in advance!
On AppDelegate.h
@property (nonatomic, strong) UINavigationController *navigationController;
on AppDelegate.m change this line on application didFinishLaunchingWithOptions
self.window.rootViewController = self.viewController;
for this
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.navigationController = aNavigationController;
self.window.rootViewController = self.navigationController;
In my project is crashing because I don't have a ConnectionViewController
, I think I didn't include the framework correctly, because I didn't know whato to do with the Resources folder, but I think it should work for you.
EDIT: I just included the resources folder, and it's working!!!
And if you don't want the navigationBar on the phonegap's view controller put in the viewDidLoad
of MainViewController.m
self.navigationController.navigationBar.hidden = YES;