【发布时间】:2016-02-17 05:46:32
【问题描述】:
我正在使用 swift 开发客户端应用程序。这是我在 swift 上的第一个应用程序。我正在尝试使用 UIImagePickerController 从我的应用程序中打开相机。下面我添加了我的代码快照。它在带有 iOS 9.2.1 的 iPhone 5s 和 6s 上运行良好。但是当我尝试在带有 iOS 8.3 的 iPod Touch 上打开时,它会提供带有按钮控件的黑色视图。我还附上了屏幕截图,它显示了它的外观。请帮助我摆脱困境。
代码:
if UIImagePickerController.isSourceTypeAvailable(.Camera) {
imagePickerViewController = UIImagePickerController()
imagePickerViewController?.delegate = self
imagePickerViewController?.allowsEditing = true
imagePickerViewController?.sourceType = .Camera
imagePickerViewController?.mediaTypes = [kUTTypeImage as String]
imagePickerViewController?.cameraCaptureMode = .Photo
presentViewController(imagePickerViewController!, animated: true, completion: nil)
}
else
{
print("Sorry cant take picture")
}
【问题讨论】:
-
你的iPod touch有摄像头吗?
-
是的,它有摄像头,可以在我的另一个用objective c编码的应用程序上工作。
标签: ios iphone swift uiimagepickercontroller