iphone - accessing function defined in another class using delegate method -


  - (शून्य) तालिकादृश्य: (UITableView *) तालिकादृश्य ने किया था SelectionRowAtIndexPath: (NSIndexPath *) indexPath {NSLog (@ " didselectrowatindexatpath "); प्लेस * प्लेसएटइंडएक्स = (प्लेस *) [ऐप डिलीगेट.प्लेसअरे ऑब्जेक्टअटइंडेक्स: इंडेक्सपाथ.रो]; एनएसएलॉग (@ "आवश्यक अक्षय लंबा है% एफ,% एफ", प्लेसएटइंडएक्स.प्लेस लैटिडेट, प्लेसएटइंडएक्स.प्लेस लैंगलिट); ReturnToMapDelegate = (CortesViewController *) [[UIApplication साझा किया गया अनुप्रयोग] प्रतिनिधि]; [वापसीटैममार्कडिलेगेट शोएड्रेस]; } - (शून्य) तालिकादृश्य: (UITableView *) तालिकादृश्य किया था SelectionRowAtIndexPath: (NSIndexPath *) indexPath को PlacesViewController.m में बुलाया जाता है और फ़ंक्शन "showaddress" को CortesViewController.h में परिभाषित किया गया है।   

मुझे त्रुटि मिल रही है "बिना किसी अपवाद के कारण ऐप रद्द करना

'NSInvalidArgumentException', कारण: '- [CortesAppDelegate showAddress]: अपरिचित चयनकर्ता को उदाहरण के लिए भेजा गया 0x146ce0 '"

लाइन पर <पूर्व> returnToMapDelegate = (CortesViewController *) [[UIApplication साझा किया गया आवेदक] प्रतिनिधि];

मैं सफलतापूर्वक कोड में प्रतिनिधि विधि का अनुसरण कर रहा हूं।

  CortesAppDelegate * appDelegate = (CortesAppDelegate *) [[UIApplication साझाअनुप्रयोग] प्रतिनिधि]; [एप डिलीएगेट एफंक्शन];   

लेकिन जब मैंने CortesViewController के लिए एक ही चीज़ की कोशिश की, तो एप्लिकेशन क्रैश हो गया। मैं आईओएस के लिए नया हूँ यह संभव हो सकता है कि मुझे बहुत ही सरल बिंदु याद आ रही है।

क्या कोई मुझे बता सकता है कि कोड में क्या गलत है?

अग्रिम में मदद के लिए धन्यवाद

समस्या निम्न में है: विधि [[UIApplication sharedApplication] प्रतिनिधि]; वर्ग CortesAppDelegate का ऑब्जेक्ट देता है। इसलिए आप showAddress पर कॉल नहीं कर सकते क्योंकि यह CortesViewController में परिभाषित है

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -