@IBAction func newPhoto(sender: AnyObject) {
if isCameraAvailable() && doesCameraSupportTakingPhotos(){
imagePicker.sourceType = .Camera
imagePicker.mediaTypes = [kUTTypeImage as String]
imagePicker.allowsEditing = true
imagePicker.delegate = self
presentViewController(imagePicker, animated: true, completion: nil)
}
}
else {
print("Camera is not available")
}
错误发生在 else { - 预期声明中 - 请帮帮我!
答案 0 :(得分:1)
在}
之前将else
移至If else
语句的末尾
@IBAction func newPhoto(sender: AnyObject) {
if isCameraAvailable() && doesCameraSupportTakingPhotos(){
imagePicker.sourceType = .Camera
imagePicker.mediaTypes = [kUTTypeImage as String]
imagePicker.allowsEditing = true
imagePicker.delegate = self
presentViewController(imagePicker, animated: true, completion: nil)
}
else {
print("Camera is not available")
}
}