- [announceViewController xCJSONDidBeginLoadingJSONData]:无法识别的选择发送到实例0x7faa01504d50

- [announceViewController xCJSONDidBeginLoadingJSONData]:无法识别的选择发送到实例0x7faa01504d50

问题描述:

我有这个问题会导致应用程序崩溃: 的万阿英,蒋达清开始时,应用程序启动时,我添加了新的观点来处理2个uiimages有两个按钮- [announceViewController xCJSONDidBeginLoadingJSONData]:无法识别的选择发送到实例0x7faa01504d50

gameApp[5963:1756169] -[announceViewController xCJSONDidBeginLoadingJSONData]: unrecognized selector sent to instance 0x7faa01504d50 
2014-11-03 09:16:01.386 gameApp[5963:1756169] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[announceViewController xCJSONDidBeginLoadingJSONData]: unrecognized selector sent to instance 0x7faa01504d50' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0000000107fe9f35 __exceptionPreprocess + 165 
    1 libobjc.A.dylib      0x0000000107c82bb7 objc_exception_throw + 45 
    2 CoreFoundation      0x0000000107ff104d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 
    3 CoreFoundation      0x0000000107f4908f ___forwarding___ + 495 
    4 CoreFoundation      0x0000000107f48e18 _CF_forwarding_prep_0 + 120 
    5 gameApp        0x0000000103d75462 -[XCJSONLoader startLoadFrom:] + 66 
    6 gameApp        0x0000000103d75de3 -[announceViewController setUpJSON] + 259 
    7 gameApp        0x0000000103d75c99 -[announceViewController viewDidLoad] + 73 
    8 UIKit        0x0000000106402a90 -[UIViewController loadViewIfRequired] + 738 
    9 UIKit        0x0000000106402c8e -[UIViewController view] + 27 
    10 UIKit        0x0000000106321ca9 -[UIWindow addRootViewControllerViewIfPossible] + 58 
    11 UIKit        0x0000000106322041 -[UIWindow _setHidden:forced:] + 247 
    12 UIKit        0x000000010632e72c -[UIWindow makeKeyAndVisible] + 42 
    13 UIKit        0x00000001062d9061 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628 
    14 UIKit        0x00000001062dbd2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350 
    15 UIKit        0x00000001062dabf2 -[UIApplication workspaceDidEndTransaction:] + 179 
    16 FrontBoardServices     0x000000010dfa62a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16 
    17 CoreFoundation      0x0000000107f1f53c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 
    18 CoreFoundation      0x0000000107f15285 __CFRunLoopDoBlocks + 341 
    19 CoreFoundation      0x0000000107f15045 __CFRunLoopRun + 2389 
    20 CoreFoundation      0x0000000107f14486 CFRunLoopRunSpecific + 470 
    21 UIKit        0x00000001062da669 -[UIApplication _run] + 413 
    22 UIKit        0x00000001062dd420 UIApplicationMain + 1282 
    23 gameApp        0x0000000103d78913 main + 115 
    24 libdyld.dylib      0x0000000108c17145 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

这里是.h文件:

#import <UIKit/UIKit.h> 
#import "XCJSONLoader.h" 

@interface announceViewController : UIViewController <XCJSONLoaderDelegate> 
@property (strong,nonatomic) XCJSONLoader *jsonLoader; 
@property (weak, nonatomic) IBOutlet UIImageView *anImageView; 
@property (weak, nonatomic) IBOutlet UIImageView *spImageView; 
- (IBAction)anButton:(id)sender; 
- (IBAction)spButton:(id)sender; 

@end 

,这是.m文件

@interface announceViewController() { 
    NSMutableArray *JSONData; 

} 

@end 

@implementation announceViewController 

@synthesize jsonLoader,anImageView,spImageView; 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view. 
    [self setUpJSON]; 
} 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

/* 
#pragma mark - Navigation 

// In a storyboard-based application, you will often want to do a little preparation before navigation 
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 
    // Get the new view controller using [segue destinationViewController]. 
    // Pass the selected object to the new view controller. 
} 
*/ 


- (void) setUpJSON 
{ 
    jsonLoader = [[XCJSONLoader alloc] init]; 

    [jsonLoader setDelegate:self]; 

    NSString *JSONLink = [NSString stringWithFormat:@"http://ya-techno.com/gameApp/anData.php"]; // Your URL goes here 


    [jsonLoader startLoadFrom:JSONLink]; 


} 
- (void)xCJSONDidFinishLoadingJSONData 
{ 
    JSONData = [jsonLoader getJSONData]; 


} 



- (IBAction)anButton:(id)sender { 
    JSONData = [jsonLoader getJSONData]; 

    NSString *anButtonString = [NSString stringWithFormat:@"%@", [[JSONData objectAtIndex:0] objectForKey:@"anButton"]]; 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:anButtonString]]; 



} 

- (IBAction)spButton:(id)sender { 
} 
@end 

我找不到这个问题。任何帮助

阅读错误。它说你还没有实施xCJSONDidBeginLoadingJSONData方法。而你没有。您确实有xCJSONDidFinishLoadingJSONData方法,但没有xCJSONDidBeginLoadingJSONData方法。

xCJSONDidBeginLoadingJSONData方法添加到您的announceViewController类中以解决问题。

顺便说一句 - 标准命名约定规定类名应该用大写字母。方法和变量名称以小写字母开头。