我正试图像这样打开相机:
mediaPicker = [[UIImagePickerController alloc] init];
[mediaPicker setDelegate:self];
mediaPicker.allowsEditing = YES;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
mediaPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:mediaPicker animated:YES completion:nil];
}
但我正在崩溃说:
-[UIImage setClipsToBounds:]: unrecognized selector sent to instance 0x1245aa9a0
堆栈跟踪:
Last Exception Backtrace:
0 CoreFoundation 0x1812bae38 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x18091ff80 objc_exception_throw + 56
2 CoreFoundation 0x1812c1ccc -[NSObject(NSObject) doesNotRecognizeSelector:] + 212
3 CoreFoundation 0x1812bec74 ___forwarding___ + 872
4 CoreFoundation 0x1811bcd1c _CF_forwarding_prep_0 + 92
5 CameraKit 0x18a3ce460 -[CMKBlurredSnapshotView initWithView:] + 344
6 CameraKit 0x18a40cb3c -[CMKCameraView _setupSuspensionSnapshotViewWithBlur:] + 88
7 CameraKit 0x18a3fd0d0 -[CMKCameraView enableCamera] + 296
8 CameraKit 0x18a3f549c -[CMKCameraView viewWillBeDisplayed] + 184
9 PhotoLibrary 0x18c11c7d4 -[PLImagePickerCameraView viewWillBeDisplayed] + 220
10 PhotoLibrary 0x18c0ec42c -[PLUICameraViewController viewWillAppear:] + 576
11 UIKit 0x18641d274 -[UIViewController _setViewAppearState:isAnimating:] + 628
12 UIKit 0x18641cfe8 -[UIViewController __viewWillAppear:] + 156
13 UIKit 0x1864c44a0 -[UINavigationController _startTransition:fromViewController:toViewController:] + 760
14 UIKit 0x1864c3ddc -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
15 UIKit 0x18679e904 -[UINavigationController _setViewControllers_7_0:transition:animated:operation:] + 3052
16 UIKit 0x18679da00 -[UINavigationController _setViewControllers:transition:animated:operation:] + 620
17 UIKit 0x18679cbfc __54-[UINavigationController setViewControllers:animated:]_block_invoke + 1232
18 UIKit 0x1867835e4 +[UIViewController _performWithoutDeferringTransitions:] + 128
19 UIKit 0x186543e50 -[UINavigationController setViewControllers:animated:] + 412
20 UIKit 0x186683bd0 -[UIImagePickerController _setupControllersForCurrentSourceType] + 172
21 UIKit 0x186683a84 -[UIImagePickerController viewWillAppear:] + 84
22 UIKit 0x18641d274 -[UIViewController _setViewAppearState:isAnimating:] + 628
23 UIKit 0x18641cfe8 -[UIViewController __viewWillAppear:] + 156
24 UIKit 0x18676424c __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 960
任何可能导致此问题的想法?
答案 0 :(得分:1)
我有完全相同的问题,它是由我的代码中名为“snapshotView() - > UIImage”扩展UIView的快速扩展引起的。
由于CameraKit中的“CMKBlurredSnapshotView”具有名为“snapshotView”的相同方法但返回了UIView,因此我的代码覆盖了系统原始方法但返回了UIImage,因此抛出了异常。
您应检查所有代码并验证是否犯了同样的错误。