I'm trying to open the camera like this:
mediaPicker = [[UIImagePickerController alloc] init];
[mediaPicker setDelegate:self];
mediaPicker.allowsEditing = YES;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
mediaPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:mediaPicker animated:YES completion:nil];
}
But I'm getting a crash saying:
-[UIImage setClipsToBounds:]: unrecognized selector sent to instance 0x1245aa9a0
Stacktrace:
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
Any ideas what might be causing this?
I've got exactly the same issue, It is caused by a swift extension which named "snapshotView() -> UIImage" extended UIView in my code.
As the "CMKBlurredSnapshotView" in CameraKit has a same method named "snapshotView" but returning a UIView, so my code overrode the system original method but return a UIImage, So the exception is thrown.
You should check all your code and verify if you make the same mistake.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.