gpt4 book ai didi

iphone - iOS 4.2 相机和相册问题

转载 作者:行者123 更新时间:2023-12-03 17:43:19 25 4
gpt4 key购买 nike

出于某种原因,我用来访问以前用于 iOS 的相机和相册的相同代码不起作用。每当我打开相机应用程序或相册时,应用程序都会崩溃,并且崩溃日志中没有任何内容。我针对 iOS 3.0 到 4.1 对其进行了测试,并且运行良好。有人遇到过这种情况吗?这是一个错误吗?它甚至没有到达 imagePickerController 方法,它在加载相机或相册后立即崩溃。

我使用的代码是这样的:

#pragma mark Photo methods

- (void) getNewPhoto {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
}

- (void)loadPhotoFromLibrary {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
}

#pragma mark ImagePickerController methods

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:NO];
selectedImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}

谢谢!

最佳答案

希望你的问题得到解决,如果不试试这个......

据我所知, UIImagePickerController 不适用于 iPad ......它无法呈现任何 View Controller ,所以尝试使用 UIPopoverController(适用于 iPad)......我使用了同样的东西,它真的很好用......

关于iphone - iOS 4.2 相机和相册问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4345617/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com