aka 'NSString' has no member - Swift

aka sorority
aka in a sentence
aka medical abbreviation
a.k.a. synonym
aka colors
aka urban dictionary
aka meaning in chat
aka merriam-webster

I'm building a QR code reader using Swift 4 and have been running into some problems, particular these messages on multiple lines:

Type 'AVMediaType' (aka 'NSString') has no member 'video'

Type 'AVMetadataObject.ObjectType' (aka 'NSString') has no member 'qr'

Type 'AVLayerVideoGravity' (aka 'NSString') has no member has no member 'resizeAspectFill'

But, the sample project I've been following builds perfectly with the same code I have.

Here's an example of the first part of my code:

import UIKit
import AVFoundation

@available(iOS 10.0, *)
class ScanViewController: UIViewController {

    var captureSession = AVCaptureSession?.self
    var videoPreviewLayer: AVCaptureVideoPreviewLayer?

    @IBOutlet weak var previewView: UIView!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Get the back-facing camera for capturing videos
        //***ERROR OCCURRS ON THIS LINE***
        let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera], mediaType: AVMediaType.video, position: .back)

        guard let captureDevice = deviceDiscoverySession.devices.first else {
            print("Failed to get the camera device")
            return
        }

Does anyone know what's causing it and how to fix it?


Fixed it!

The solution is instead of video being a property of AVMediaType, AVMediaTypeVideo is its own thing. Use that for Swift 4 in iOS 10.2 and higher.

What Does the Acronym a.k.a. or aka Mean? – Grammarist, What does the abbreviation aka stand for? Meaning: also known as. Click here to view the Press Conference : Click here to view the Press Conference


Your deployment target looks like iOS 10.0. AVMediaType and AVLayerVideoGravity are available from iOS 11. You should either increase your Deployment Target or use older alternatives like AVMediaTypeVideo

How to Use "AKA": 6 Steps (with Pictures), AKA. Use aka in a sentence. abbreviation. The definition of aka is an abbreviation that means also-known-as. When your name is Joe but you are also known as Joseph, this is an example of a situation where you are Joe AKA Joseph. Aka definition, also known as: According to police records he is Joe Smith a.k.a. “Baby Face Smith” and Joseph Smathers. See more.


Fix as follows for Swift 4.x

Change

AVMediaType.video

to

AVMediaTypeVideo

A.k.a. Synonyms & Antonyms, An abbreviation meaning “also known as.” It is primarily used by law enforcement officials to specify an alias: “John Smith, aka Jonathan Jones.” notes for aka. The​  Aka is another spelling of the same abbreviation. The only difference is that it leaves out the periods. Aka is still pronounced “ay-kay-ay,” and it means exactly the same thing and fits into all the same contexts as a.k.a. In fact, most sources prefer aka to a.k.a., including AP style, Merriam-Webster, and the Oxford English Dictionary.


Aka, A.k.a. definition, also known as: According to police records he is Joe Smith a.k.a. “Baby Face Smith” and Joseph Smathers. See more. Alpha Kappa Alpha Sorority, Incorporated (ΑΚΑ) is the first historically African American Greek-lettered sorority for college-educated women. The organization was founded on five basic tenets: To cultivate and encourage high scholastic and ethical standards, to promote unity and friendship among college women, to study and help alleviate problems concerning girls and women in order to


Aka, Generally, a large (broad, tall, or buff) attractive man, who tends to be not very bright, but usually extremely nice and respectful. Think Kronk from The Emperors​  Aka people, a group of African pygmies living in the Central African Republic and Congo Aka (tribe), a tribe found in West and East Kameng, Arunachal Pradesh, India AKA (rapper) (Kiernan Forbes, born 1988), South African hip-hop recording artist


AKA 1908, The terms a.k.a. and aka are acronyms for the phrase also known as. Most often used to describe a person's aliases, pseudonyms or nicknames, a.k.a. and aka  Aka is a large, bulky violet humanoid. On his head, he has two large ears and an antenna. Also, he has a large chin with spikes. On his body, he has spikes.