https://github.com/queeniecplusplus/ios_back_2
Camera Feature: to touch screen to call the camera, and save image in photo lib
https://github.com/queeniecplusplus/ios_back_2
ios ios10 ios11 ios14 swift uiimagepickercontroller
Last synced: 8 months ago
JSON representation
Camera Feature: to touch screen to call the camera, and save image in photo lib
- Host: GitHub
- URL: https://github.com/queeniecplusplus/ios_back_2
- Owner: QueenieCplusplus
- Created: 2021-01-27T03:15:09.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-27T03:25:37.000Z (over 5 years ago)
- Last Synced: 2025-01-06T04:25:04.854Z (over 1 year ago)
- Topics: ios, ios10, ios11, ios14, swift, uiimagepickercontroller
- Homepage: https://github.com/QueenieCplusplus/QuickGoThru/blob/master/README.md#apple-ios-swift-溫故愛鳳---計畫復甦
- Size: 1.3 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# iOS_Back_2
Camera Feature: to touch screen to call the camera, and save image in photo lib
1. add K/V to ask for users auhthorization to camera usage and usage of image saving.
Privacy - Camera Usage Description
Privacy - Photo Lib Add Usage Description

ref: https://medium.com/彼得潘的-swift-ios-app-開發問題解答集/ios-10存取使用者私密資料都要加上usage-description-a01715e56491
2. code in ControllerView.
// ViewController.swift
// KatesCamera
//
// Created by KatesAndroid on 2021/1/27.
//
import UIKit
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func touchesEnded(_ touches: Set, with event: UIEvent?) {
let imgP = UIImagePickerController()
imgP.sourceType = .camera
imgP.delegate = self
show(imgP, sender: self)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
let img = info[UIImagePickerController.InfoKey.originalImage] as! UIImage
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil)
dismiss(animated: true, completion: nil)
}
}
ref: https://stackoverflow.com/questions/41717115/how-to-make-uiimagepickercontroller-for-camera-and-photo-library-at-the-same-tim
3. run iPhone Simulator.

4. Reason for Exception Error occured.
