我收到以下警告:
控制可能会达到非无效功能的终点
使用来自developer.apple.com的一些代码时:
Apple's code for Taking Pictures and Movies
- (BOOL) startCameraControllerFromViewController: (UIViewController*) controller usingDelegate: (id <UIImagePickerControllerDelegate,UINavigationControllerDelegate>) delegate
{
if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == NO) || (delegate == nil) || (controller == nil)) return NO;
UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:
UIImagePickerControllerSourceTypeCamera];
cameraUI.allowsEditing = NO;
cameraUI.delegate = delegate;
[controller presentViewController:cameraUI animated:YES completion:nil];
}
谁能告诉我为什么?
最佳答案
您需要在函数中返回BOOL值才能摆脱警告
线后只需致电
[controller presentViewController:cameraUI animated:YES completion:nil];
return YES;
关于ios - 使用Apple的代码时,控件可能会达到非空函数的结尾,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19021163/