我像这样呈现我的视图控制器:
- (void) showImagePicker:(UIImagePickerControllerSourceType)source {
[self dismissKeyboard];
if(self.cameraImagePicker == nil) {
self.cameraImagePicker = [[UIImagePickerController alloc] init];
}
self.cameraImagePicker.delegate = self;
self.cameraImagePicker.allowsEditing = YES;
self.cameraImagePicker.sourceType = source;
//[self presentModalViewController:self.cameraImagePicker animated:YES];
[self presentViewController:self.cameraImagePicker animated:NO completion:nil];
}
然而,每当我致电[self dismissViewControllerAnimated:NO completion:nil];
时,它不仅会关闭图像选择器,还会关闭我当前所处的视图。
如何在不杀死当前视图的情况下关闭UIImagePickerController?
修改
这是我的解雇代码。
dispatch_queue_t queue = dispatch_get_main_queue();
dispatch_async(queue, ^{
NSURL *url = [NSURL URLWithString:[[responseObject objectForKey:@"result"] objectForKey:@"image"]];
NSData *data = [NSData dataWithContentsOfURL:url];
self.displayPictureView.image = [UIImage imageWithData:data];
data = nil;
[self.cameraImagePicker dismissViewControllerAnimated:NO completion:nil];
});
和控制台日志。
Jul 3 14:36:45 Damons-iPhone kernel[0] <Debug>: AppleH4CamIn::power_on_hardware
Jul 3 14:36:46 Damons-iPhone kernel[0] <Debug>: AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 0
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.routined[4653]) <Notice>: (com.apple.routined) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.routined[4653]) <Error>: (com.apple.routined) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.mediaremoted[4652]) <Notice>: (com.apple.mediaremoted) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.mediaremoted[4652]) <Error>: (com.apple.mediaremoted) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.timed[4689]) <Notice>: (com.apple.timed) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.timed[4689]) <Error>: (com.apple.timed) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.networkd_privileged[4693]) <Notice>: (com.apple.networkd_privileged) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.networkd_privileged[4693]) <Error>: (com.apple.networkd_privileged) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4692]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4692]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.securityd[4690]) <Notice>: (com.apple.securityd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.securityd[4690]) <Error>: (com.apple.securityd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4694]) <Notice>: (com.apple.nsnetworkd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4694]) <Error>: (com.apple.nsnetworkd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4695]) <Notice>: (com.apple.nsnetworkd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4695]) <Error>: (com.apple.nsnetworkd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4696]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4696]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4697]) <Notice>: (com.apple.nsnetworkd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4697]) <Error>: (com.apple.nsnetworkd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4698]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4698]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:50 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4700]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:50 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4700]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4699]) <Notice>: (com.apple.nsnetworkd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4699]) <Error>: (com.apple.nsnetworkd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4701]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4701]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4703]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4703]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4702]) <Notice>: (com.apple.nsnetworkd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4702]) <Error>: (com.apple.nsnetworkd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4704]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4704]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4706]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4706]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4705]) <Notice>: (com.apple.nsnetworkd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.nsnetworkd[4705]) <Error>: (com.apple.nsnetworkd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4708]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4708]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4710]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4710]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:51 Damons-iPhone ****[4687] <Warning>: Received memory warning.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4711]) <Notice>: (com.apple.lsd) Idle-exit job was jettisoned. Will bypass throttle interval for next on-demand launch.
Jul 3 14:36:51 Damons-iPhone com.apple.launchd[1] (com.apple.lsd[4711]) <Error>: (com.apple.lsd) assertion failed: 11D201: launchd + 35933 [666E5F5B-36E7-3134-852E-A4BFEF07CD31]: 0x9
Jul 3 14:36:52 Damons-iPhone kernel[0] <Debug>: AppleH4CamIn::setPowerStateGated: 0
Jul 3 14:36:52 Damons-iPhone kernel[0] <Debug>: AppleH4CamIn::power_off_hardware