2012-10-03 4 views
5

मुझे अपने एप्लिकेशन के रूटव्यू कंट्रोलर के साथ कोई समस्या है। जब मैं ऐप चलाता हूं तो मुझे यह त्रुटि मिलती है। इसका क्या मतलब है?यह क्लास कुंजी छवि के लिए महत्वपूर्ण मूल्य कोडिंग-अनुरूप नहीं है

NSUnknownKeyException', reason: '[<UIApplication 0x8634010> setValue:forUndefinedKey:]:  this class is not key value coding-compliant for the key bigImageView.' 
First throw call stack: 
(0x1992012 0x1357e7e 0x1a1afb1 0xe04711 0xd85ec8 0xd859b7 0xdb0428 0x4bc0cc 
0x136b663 0x198d45a 0x4babcf 0x4bc98d 0x29eceb 0x29f002 0x29ded6 0x2af315 0x2b024b 
0x2a1cf8 0x1dbedf9 0x1dbead0 0x1907bf5 0x1907962 0x1938bb6 0x1937f44 0x1937e1b 0x29d7da 0x29f65c 0x2c6d 0x2b95) 
libc++abi.dylib: terminate called throwing an exception 

RootViewController.m

#import "RootViewController.h" 
    #import "MenuViewController.h" 

    @interface RootViewController() 

    @end 

    @implementation RootViewController 

    @synthesize bigImageView; 
    @synthesize fromRootViewController; 

    - (void)viewDidLoad 
    { 
     [super viewDidLoad]; 
     UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice]orientation]; 

      if(deviceOrientation == UIInterfaceOrientationPortrait || deviceOrientation== UIInterfaceOrientationPortraitUpsideDown) { 
    self.bigImageView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"milanocina_V.png"]]; 

} 
else if (deviceOrientation== UIInterfaceOrientationLandscapeRight){ 
    self.bigImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"milanocina_O.png"]]; 

} 
else if (deviceOrientation==UIInterfaceOrientationLandscapeLeft){ 

    self.bigImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"milanocina_O.png"]]; 



} 

[self.view addSubview:self.bigImageView]; 

UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; 
recognizer.delegate = self; 
[self.view addGestureRecognizer:recognizer]; 

} 

RootViewController में RootViewController.h

#import <UIKit/UIKit.h> 


    @interface RootViewController : UIViewController <UIGestureRecognizerDelegate>{ 

    } 

@property (nonatomic, copy)IBOutlet UIImageView * bigImageView; 
@property (nonatomic, assign)BOOL fromRootViewController; 


- (void)handleTap:(UITapGestureRecognizer *)recognizer; 



@end 

मेरे कोड में मेरे कोड शुरू में ViewController कहा जाता है और मैं नाम बदल दिया है। त्रुटि से सहसंबंधित किया जा सकता है? मैं क्या कर सकता हूँ?

+1

क्या आपने देखा कि त्रुटि संदेश कहता है कि आप उस संपत्ति को 'यूआईआईपीप्लिकेशन' पर सेट करने का प्रयास कर रहे हैं ... 'रूट व्यू कंट्रोलर' पर दुनिया के सभी कोड में कोई फर्क नहीं पड़ता। मुझे यकीन है कि आपकी एक्सआईबी फाइल में एक दोषपूर्ण लिंक है। खराब लिंक छोटे स्पष्टीकरण बिंदुओं के साथ दिखाई देंगे। – borrrden

+0

मुझे खराब कनेक्शन कैसे मिलता है? –

+0

मुझे नहीं पता कि यह आपकी समस्या का कारण बन रहा है, लेकिन आप BigImageView के साथ कुछ गलत कर रहे हैं। आप इसे आईबीओलेट के रूप में परिभाषित करते हैं, लेकिन फिर इसे कोड में बनाए गए उदाहरणों को असाइन करें। यदि आप इसे आईबी में एक इमेज व्यू में जोड़ रहे हैं तो आपके पास वहां है, तो कोड उस पर ओवरराइड करेगा। यह शायद आईबीओलेट नहीं होना चाहिए, क्योंकि आपको इसे अभिविन्यास के आधार पर अलग-अलग चीजों की आवश्यकता होती है। – rdelmar

उत्तर

3

यहां एक और संभावना है: आपने अपनी कक्षा का नाम बदल दिया है, लेकिन आपका UIViewController प्रारंभिक कोड बदलने के लिए भूल गया है।

NewViewController *vc; 
vc = [[NewViewController alloc] initWithNibName:@"OldViewController" bundle:nil]; 

एक बार मैं @ "NewViewController" के साथ स्ट्रिंग प्रतिस्थापित @ "OldViewController", समस्या दूर चला गया: मेरे लिए, यह इस था।

14

किसी बिंदु पर, आप @property सेट करते हैं। फिर आपने इसे अपने कोड से हटा दिया लेकिन इसे अपने xib/storyboard में नहीं देखा। आपको इसे अपने स्टोरीबोर्ड में ढूंढना होगा, इसे ठीक से क्लिक करना होगा, और आउटलेट हटा देना होगा।

संबंधित मुद्दे