जब मैं यहां से ऐप को रीस्टार्ट करता हूं: https://github.com/zweigraf/face-landmarking-ios कैमरे से चित्र प्रकट नहीं होता है और मुद्रण त्रुटि: "enqueueSampleBuffer को अनदेखा कर रहा है क्योंकि स्थिति विफल हो गई है"।
समस्या शायद सत्रहैंडलर.स्विफ्ट से कैप्चरऑउटपुट में है
1 उत्तर
मैं एक समाधान ढूंढता हूं! AVSampleBufferDisplayLayer ऑपरेशन इंटरप्टेड (-11847) के साथ विफल क्यों हो जाता है, इसके लिए धन्यवाद? ए>
यदि आपको इसी तरह की समस्या थी, तो आपको हर बार ऐप को अग्रभूमि में प्रवेश करने पर AVSampleBufferDisplayLayer सेट करने की आवश्यकता होती है। ऐशे ही:
//AppDelegate.swift
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
viewcontroller?.setLayer()
}
//ViewController.swift
func setLayer() {
sessionHandler.layer = AVSampleBufferDisplayLayer()
sessionHandler.layer.frame = preview.bounds
sessionHandler.layer.videoGravity = AVLayerVideoGravityResizeAspectFill
preview.layer.addSublayer(sessionHandler.layer)
}
और सबलेयर को हटाना न भूलें:
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
viewcontroller?.sessionHandler.layer.removeFromSuperlayer()
}
नए सवाल
ios
iOS, Apple iPhone, iPod टच और iPad पर चलने वाला मोबाइल ऑपरेटिंग सिस्टम है। IOS प्लेटफॉर्म पर प्रोग्रामिंग से संबंधित प्रश्नों के लिए इस टैग [ios] का उपयोग करें। उन प्रोग्रामिंग भाषाओं के लिए विशिष्ट मुद्दों के लिए संबंधित टैग [उद्देश्य-सी] और [स्विफ्ट] का उपयोग करें।