Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rich1812

macrumors regular
Original poster
Oct 4, 2015
117
5
earth
Hi, I am new to this swift thing, I study a piece of downloaded code, when I try to run it, it gives me an error,
"Use of unresolved identifier 'beginSession'" at the top of the code, I imported UIKit and imported AVFoundation. is there anything else I need to import? Thanks.
BTW I use xcode 9.4.1.
Code:
/ Loop through all the capture devices on this phone
        for device in devices {
            // Make sure this particular device supports video
            if (device.hasMediaType(AVMediaTypeVideo)) {
                // Finally check the position and confirm we've got the back camera
                if(device.position == AVCaptureDevicePosition.Back) {
                    captureDevice = device as? AVCaptureDevice
                    if captureDevice != nil {
                        println("Capture device found")
                        beginSession()           ! Use of unresolved identifier 'beginSession'
                    }
                }
            }
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.