我非常熟悉iOS应用程序开发。目前我正在研究一个很久以前建成的项目(我想在2011年)。
我对xcode和目标C没有太多了解。
我已经解决了一些问题,但无法解决这个问题:(
虽然很多其他人已经问过这个问题,但我无法找到解决方法。
我收到错误
2016-10-26 12:51:59.200 TestCordova1[12758:1094626] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [AppDelegate application:didFinishLaunchingWithOptions:]: unrecognized selector sent to instance 0x7fc476e02be0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010310134b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010221621e objc_exception_throw + 48
2 CoreFoundation 0x0000000103170f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000103086a2e ___forwarding___ + 526
4 CoreFoundation 0x0000000103086798 _CF_forwarding_prep_0 + 120
5 TestCordova1 0x0000000101ba8810 -[AppDelegate application:didFinishLaunchingWithOptions:] + 304
6 UIKit 0x0000000103e5568e -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
7 UIKit 0x0000000103e57013 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
8 UIKit 0x0000000103e5d3b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
9 UIKit 0x0000000103e5a539 -[UIApplication workspaceDidEndTransaction:] + 188
10 FrontBoardServices 0x000000010832a76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
11 FrontBoardServices 0x000000010832a5e4 -[FBSSerialQueue _performNext] + 189
12 FrontBoardServices 0x000000010832a96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
13 CoreFoundation 0x00000001030a6311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010308b59c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x000000010308aa86 __CFRunLoopRun + 918
16 CoreFoundation 0x000000010308a494 CFRunLoopRunSpecific + 420
17 UIKit 0x0000000103e58db6 -[UIApplication _run] + 434
18 UIKit 0x0000000103e5ef34 UIApplicationMain + 159
19 TestCordova1 0x0000000101ba5714 main + 100
20 libdyld.dylib 0x00000001057fb68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
我的main.m文件
#import <UIKit/UIKit.h>
int main(int argc, char* argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
[pool release];
return retVal;
}
AppDelegate.h
#import <UIKit/UIKit.h>
#import <Cordova/CDVViewController.h>
@interface AppDelegate : CDVViewController {
NSString* invokeString;
}
@property (copy) NSString* invokeString;
@property (weak) IBOutlet UIWindow *window;
@property(nonatomic, strong) UIViewController *viewController;
@end
AppDelegate.m文件
#import <UIKit/UIKit.h>
#import "MainViewController.h"
#import <AVFoundation/AVFoundation.h>
#import "abcPlugin.h"
#import "FileIO.h"
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize invokeString;
- (id) init
{
return [super init];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSArray *keyArray = [launchOptions allKeys];
if ([launchOptions objectForKey:[keyArray objectAtIndex:0]]!=nil)
{
NSURL *url = [launchOptions objectForKey:[keyArray objectAtIndex:0]];
self.invokeString = [url absoluteString];
NSLog(@"LEMobileApp launchOptions = %@",url);
}
BOOL retVal = [super application:application didFinishLaunchingWithOptions:Nil];
if (retVal == YES) {
// Set the root view controller of the window
[self.window setRootViewController:self.viewController];
abcPlugin* objabcPlugin = [[abcPlugin alloc] init];
[objabcPlugin showSplashScreen];
}
return retVal;
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
}
-(id) getCommandInstance:(NSString*)className
{
return [super getCommandInstance:className];
}
- (void)webViewDidFinishLoad:(UIWebView *)theWebView
{
if(self.invokeString)
{
NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
}
[ super webViewDidFinishLoad:theWebView ];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
// Add our custom splashscreen
abcPlugin* objabcPlugin = [[abcPlugin alloc] init];
[objabcPlugin showSplashScreen];
return;
}
- (void)webViewDidStartLoad:(UIWebView *)theWebView
{
return [ super webViewDidStartLoad:theWebView ];
}
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest: (NSURLRequest *)request navigationType: (UIWebViewNavigationType)navigationType
{
NSURLRequest * req = request;
if ([[[request URL] absoluteString] isEqualToString: @"about:blank"]) {
NSLog(@"rewriting about blank");
NSString* app = [[NSBundle mainBundle] resourcePath];
NSString* Newpath = [NSString stringWithFormat: @"%@/www/index.html", app];
NSURL* NewURL = [NSURL fileURLWithPath:Newpath];
req = [NSURLRequest requestWithURL:NewURL];
}
return [ super webView:theWebView shouldStartLoadWithRequest:req navigationType:navigationType ];
}
- (BOOL)execute:(CDVInvokedUrlCommand*)command
{
return [ super execute:command];
}
- (void)dealloc
{
[ super dealloc ];
}
@end
我正在使用
cordova
。
任何帮助将不胜感激