swift

AVAudioCompressedBuffer to UInt8 array and vice versa

≯℡__Kan透↙ 提交于 2021-02-19 20:57:05
问题 I would like to know how to get the bytes of an AVAudioCompressedBuffer and then reconstruct an AVAudioCompressedBuffer from the bytes. The code below takes an AVAudioPCMBuffer, compresses it with AVAudioConverter to AVAudioCompressedBuffer (iLBC) and gets the bytes, then converts the bytes back to AVAudioCompressedBuffer (iLBC) and uncompresses back to AVAudioPCMBuffer and plays the buffer. Something goes wrong with converting the AVAudioCompressedBuffer to bytes and back. If I skip this

AVAudioCompressedBuffer to UInt8 array and vice versa

Deadly 提交于 2021-02-19 20:56:15
问题 I would like to know how to get the bytes of an AVAudioCompressedBuffer and then reconstruct an AVAudioCompressedBuffer from the bytes. The code below takes an AVAudioPCMBuffer, compresses it with AVAudioConverter to AVAudioCompressedBuffer (iLBC) and gets the bytes, then converts the bytes back to AVAudioCompressedBuffer (iLBC) and uncompresses back to AVAudioPCMBuffer and plays the buffer. Something goes wrong with converting the AVAudioCompressedBuffer to bytes and back. If I skip this

Saving EXIF data to JPEG - Swift

丶灬走出姿态 提交于 2021-02-19 15:33:40
问题 I am currently trying to shoot photos within an app with the UIImagePickerController, saving it to the local database and upload them later to a service. But it seems that the metadata (especially EXIF) are not bundled with this image automatically. I've tried to extract it like this: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { self.imageDelegate?.saveImage( image: info[UIImagePickerControllerOriginalImage] as! UIImage,

Saving EXIF data to JPEG - Swift

三世轮回 提交于 2021-02-19 15:33:28
问题 I am currently trying to shoot photos within an app with the UIImagePickerController, saving it to the local database and upload them later to a service. But it seems that the metadata (especially EXIF) are not bundled with this image automatically. I've tried to extract it like this: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { self.imageDelegate?.saveImage( image: info[UIImagePickerControllerOriginalImage] as! UIImage,

How to get data from a map (object) Cloud Firestore document on Swift 4.2?

偶尔善良 提交于 2021-02-19 09:11:01
问题 I am using Cloud Firestore as a Database for my iOS App. I have an issue while I want to query my data when the document contains Maps (Object Type). I can not access the fields (say: firstName here) of a map (nameOnId) by having the simple query. My code is as bellow: let db = Firestore.firestore() db.collection("userDetails").getDocuments() { (querySnapshot, err) in if let err = err { print("Error getting documents: \(err)") } else { for document in querySnapshot!.documents { let results =

How to get data from a map (object) Cloud Firestore document on Swift 4.2?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-19 09:09:22
问题 I am using Cloud Firestore as a Database for my iOS App. I have an issue while I want to query my data when the document contains Maps (Object Type). I can not access the fields (say: firstName here) of a map (nameOnId) by having the simple query. My code is as bellow: let db = Firestore.firestore() db.collection("userDetails").getDocuments() { (querySnapshot, err) in if let err = err { print("Error getting documents: \(err)") } else { for document in querySnapshot!.documents { let results =

How to get data from a map (object) Cloud Firestore document on Swift 4.2?

偶尔善良 提交于 2021-02-19 09:06:56
问题 I am using Cloud Firestore as a Database for my iOS App. I have an issue while I want to query my data when the document contains Maps (Object Type). I can not access the fields (say: firstName here) of a map (nameOnId) by having the simple query. My code is as bellow: let db = Firestore.firestore() db.collection("userDetails").getDocuments() { (querySnapshot, err) in if let err = err { print("Error getting documents: \(err)") } else { for document in querySnapshot!.documents { let results =

Dateformatter issue in swift

青春壹個敷衍的年華 提交于 2021-02-19 09:05:19
问题 My API sending me date string in UTC like 2/20/2016 11:45 AM. For displaying date in my timezone, I am converting date from UTC to Local time zone like below code let sourceDateString = "12/20/2016 11:45 AM" let formatter = DateFormatter() formatter.dateFormat = "MM/dd/yyyy hh:mm a" formatter.timeZone = TimeZone(identifier: "UTC") let date = formatter.date(from: sourceDateString) print(date) formatter.timeZone = NSTimeZone.local formatter.dateFormat = "MMM dd,yyyy hh:mm a" let strDate =

Dateformatter issue in swift

让人想犯罪 __ 提交于 2021-02-19 09:03:51
问题 My API sending me date string in UTC like 2/20/2016 11:45 AM. For displaying date in my timezone, I am converting date from UTC to Local time zone like below code let sourceDateString = "12/20/2016 11:45 AM" let formatter = DateFormatter() formatter.dateFormat = "MM/dd/yyyy hh:mm a" formatter.timeZone = TimeZone(identifier: "UTC") let date = formatter.date(from: sourceDateString) print(date) formatter.timeZone = NSTimeZone.local formatter.dateFormat = "MMM dd,yyyy hh:mm a" let strDate =

How to draw line node keep same size in camera as Measure App in iPhone?

隐身守侯 提交于 2021-02-19 09:00:23
问题 I try make an AR app as a Measure default app in iPhone. ( I base on project TBXark/Ruler on github) I draw startNode, endNode, cylinder line, and SCNText. But I can't manage the scale of size, it only readable in near, and so small when measure far plane detect. I have 2 question: How to keep size node, cylinder and text same when draw near or far as Measure App How to draw scntext with background and align the same direction cylinder line as Measure App. Here is my Line Node class: class