我正在通过 PhoneGap 插件加载应用程序(通过嵌入式框架)。
现在,我试图将当前 UIViewController 传递给FlashizFacade对象的parentViewController属性。
当我执行我的应用程序时,我在分配self时在调试控制台中收到此错误:
2012-09-10 13:01:43.663 gTicketSales[2805:16a03]-[FlashizPlugin navigationController]:无法识别的选择器发送到实例 0x91925e0
2012-09-10 13:01:43.665 gTicketSales[2805:16a03] ***WebKit 在 webView:decidePolicyForNavigationAction:request:frame:decisionListener:delegate:
<NSInvalidArgumentException>
-[FlashizPlugin navigationController]: 发送到实例 0x91925e0 的无法识别的选择器中丢弃了一个未捕获的异常
分配self.viewController时:
2012-09-10 14:31:21.455 gTicketSales[3693:16a03] ***WebKit 在 webView:decidePolicyForNavigationAction:request:frame:decisionListener:delegate 中丢弃了一个未捕获的异常:
<Wrong parentViewController specified>
使用非模态显示时,parentViewController 必须是分配了有效导航控制器的 UIViewController 实例
我试过了:
facade.parentViewController = self;
facade.parentViewController = self.viewController;
我的 .h 文件
#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
我的 .m 文件
#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
提前致谢!