मैंने "प्रमाणीकरण ViewController.hx" नामक दृश्य नियंत्रक के साथ एक ढांचा बनाया है जिसे "प्रमाणीकरणViewController.xib" के साथ बनाया गया है। और परीक्षण करने के लिए नमूना प्रोजेक्ट प्रमाणीकरण व्यू कंट्रोलर प्रस्तुत करने के लिए उपयोग किया जाता है। Objective-C
में:स्विफ्ट में बाहरी ढांचे से दृश्य नियंत्रक कैसे पेश करें?
NSString *frameworkDirPath = [[NSBundle mainBundle] privateFrameworksPath];
NSString *frameworkBundlePath = [frameworkDirPath stringByAppendingPathComponent:@"SendOTPFramework.framework"];
NSBundle *frameworkBundle = [NSBundle bundleWithPath:frameworkBundlePath];
AuthenticationViewController *authenticationViewController = [[AuthenticationViewController alloc]initWithNibName:@"AuthenticationViewController" bundle:frameworkBundle];
authenticationViewController.delegate = self;
[self presentViewController:authenticationViewController animated:YES completion:nil];
कौन सा मेरे लिए ठीक काम करता है।
लेकिन जब मैं Swift
में निम्न कोड का उपयोग करें: त्रुटि के साथ
let frameworkBundle = NSBundle(identifier: "SendOTPFramework")
let authViewControler :AuthenticationViewController = AuthenticationViewController.init(nibName: "AuthenticationViewController", bundle: frameworkBundle)
authViewControler.delegate = self
self.presentViewController(authViewControler, animated: true, completion: nil)
ऐप्लिकेशन क्रैश: -?
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'AuthenticationViewController''
परियोजना में शामिल ढांचे के बंडल पहचानकर्ता "पहचानकर्ता" है। या ढांचे का नाम शामिल है। –
@ हुसैन छत्रियावाला ढांचे के बंडल पहचानकर्ता। आप स्विफ्ट में पथ फ़ंक्शन का भी उपयोग कर सकते हैं। – Lumialxk
उपरोक्त नियंत्रक को खोलने में सक्षम काम किया। लेकिन ऐप प्रतिनिधि पर बिना किसी क्रैश लॉग के कुछ सेकंड के बाद भी ऐप क्रैश हो जाता है। –