iOS 16.2 expands AirDrop 10-minute limit for all users

In iOS 16.2 Everyone for airdrop can still be enabled to allow users to receive content from anyone, but it  will turn off after a 10 minuteand  change to Contacts Only. The tweak will require users to explicitly activate AirDrop to receive files and photos from unknown.

According to an online user report Apple says it is improving the AirDrop experience by automatically reverting the  to Contacts Only after 10 minutes to help ease unwanted file sharing.

Apple drew criticism for this change, as protesters in China had been using AirDrop to spread posters and other content in opposition to the prime minister or the Chinese government. The Chinese government is believed to have made the change request to Apple, and Apple respect that request.

The default setting of AirDrop is Contacts Only. A user needs to manually change the setting to receive files from Everyone.

How to play audio from url

    func saveFile(url:URL){

        let docUrl:URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! as URL

    let desURL = docUrl.appendingPathComponent(“sample.mp3”) //Use file name with ext

    var downloadTask:URLSessionDownloadTask

    downloadTask = URLSession.shared.downloadTask(with: url, completionHandler: { [weak self](URLData, response, error) -> Void in

        do{

            let isFileFound:Bool? = FileManager.default.fileExists(atPath: desURL.path)

            if isFileFound == true{

                print(desURL)

                self?.playSound(path: desURL.path)

            } else {

                try FileManager.default.copyItem(at: URLData!, to: desURL)

                self?.playSound(path: desURL.path)

            }

        }catch let err {

            print(err.localizedDescription)

        }

    })

    downloadTask.resume()

    }

    func playSound(path : String) {

        let url = URL(fileURLWithPath: path)

        do {

            //let data = try Data(contentsOf: url)

            player = try AVAudioPlayer(contentsOf: url)

            player?.play()

        } catch let error {

            print(error.localizedDescription)

        }

    }

USE HERE

 self.saveFile(url: yoururl)

How to map an array in a Firestore document to Swift?

struct maindata {

    var userID: String

    var extended: [Contents]

    init(Doc: DocumentSnapshot) {

        self.userID = Doc.get(“userID”) as? String ?? “nil”

        extended = []

        let data = Doc.data( )

        if let testarr = data?[“testarr”] as? [[String: Any]]{

            testarr.forEach { sany in

                if let content = Contents(data: sany){

                    self.extended.append(content)

                }

            }

        }

    }

}

struct Contents {

    var IDone: String

    var IDtwo: String

    init?(data: [String: Any]) {

        self.IDone = data[“one”] as? String ?? “”

        self.IDtwo = data[“two”] as? String ?? “”

    }

}

How to use example

Firestore.firestore().collection(“LiveApi”).document(“test”).getDocument { docsnap, error in

            if let docs = docsnap {

                let data = maindata(Doc: docs)

                data.extended.first?.IDone

                data.extended[1].IDtwo

            }

        }