我的代码中没有调用didOutputSampleBuffer函数.我不知道为什么会这样.这是代码:
import UIKit
import AVFoundation
import Accelerate
class ViewController: UIViewController {
var captureSession: AVCaptureSession?
var dataOutput: AVCaptureVideoDataOutput?
var customPreviewLayer: AVCaptureVideoPreviewLayer?
@IBOutlet weak var camView: UIView!
override func viewWillAppear(animated: Bool) {
super.viewDidAppear(animated)
captureSession?.startRunning()
//setupCameraSession()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//captureSession?.startRunning()
setupCameraSession()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func setupCameraSession() {
// Session
self.captureSession = AVCaptureSession()
captureSession!.sessionPreset = …Run Code Online (Sandbox Code Playgroud) 在我的计算机上,long最大值为9223372036854775807。但是,当我unsigned long对较大的值感到厌倦时,编译器会发出警告,指出需要将其解释为unsigned long已经定义了该值。为什么会这样?
//assigning maximum value of a long integer. (No error)
long max_l = 9223372036854775807L;
//assigning an unsigned long integer.
unsigned long max_ul = 9223372036854775808L; //warning: integer literal is too large to be represented in a signed
//integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
Run Code Online (Sandbox Code Playgroud)
cc --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Run Code Online (Sandbox Code Playgroud) c unsigned implicit-conversion unsigned-integer long-integer