Rob*_*eph 3 xcode avfoundation ios xcode8-beta2
我使用Swift 3.0和Xcode 8 Beta 2创建了一个iOS单视图应用程序.我正在使用AVFoundation.framework.
这是我的视图控制器代码:
import UIKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
if AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) == .notDetermined {
AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo, completionHandler: { (granted: Bool) in
if granted {
print("granted")
}
else {
print("not granted")
}
})
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我在我的设备上运行它时,应用程序在执行该AVCapture.requestAccess行后崩溃(未执行完成处理程序且不抛出任何异常).
控制台中唯一的事情是:
2016-07-15 14:55:44.621819 testpp[2261:912051] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2016-07-15 14:55:44.626012 testpp[2261:912051] [MC] Reading from public effective user settings.
2016-07-15 14:55:59.284610 testpp[2261:912085] [access] <private>
Run Code Online (Sandbox Code Playgroud)
难道我做错了什么?
| 归档时间: |
|
| 查看次数: |
5056 次 |
| 最近记录: |