카메라 버튼을 사용하여 사진을 찍을 수있는 테스트 앱을 만들었습니다. 시뮬레이터에서 테스트 중이므로 스냅 샷을 만들 수 없습니다. 하지만 호출 될 때 사용자가 사진 라이브러리에서 사진을 선택할 수있는 IBAction 메서드를 만들었습니다. 위의 시나리오에서NSLog가 실행되지 않음
- (IBAction)takePicture:(id)sender {
NSLog(@"Camera button tapped");
UIImagePickerController *imagePicker= [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
NSLog(@"Yes. The Camera is available");
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
}
else{
NSLog(@"The Camera isn't available. Try thru the Photo Library");
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
imagePicker.allowsEditing=YES;
[imagePicker setDelegate:self];
NSLog(@"Presenting Modal Controller");
[self presentViewController:imagePicker animated:YES completion:NULL];
}
, 메소드가 콘솔뿐만 아니라 카메라 버튼을 탭 메시지를 기록하지 않습니다 (내가 카메라 모음 단추 항목을 누를 때 즉)이라고합니다 - : 이는 방법 모달 컨트롤러 제시 메시지. 다른 모든 적절한 NSLog 메시지는 그대로 기록됩니다. 런타임에서이 NSLog 행을 어떻게 실행하지 않는지 이해할 수 없습니다. 비슷한 문제가 있습니다 - (void) imagePickerController : (UIImagePickerController *) picker didFinishPickingMediaWithInfo : (NSDictionary *) info 내가 직면하고 있습니다. 구현 방법은 다음과 같습니다.
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSLog(@"imagePicker called");
NSString *oldKey= _item.imageKey;
if (oldKey) {
NSLog(@"Deleting image having key- %@",oldKey);
[[BNRImageStore sharedStore] deleteImageForKey:oldKey];
}
UIImage *image= [info objectForKey:UIImagePickerControllerEditedImage];
CFUUIDRef newUniqueID= CFUUIDCreate(kCFAllocatorDefault);
CFStringRef newUniqueIDString= CFUUIDCreateString(kCFAllocatorDefault, newUniqueID);
//Use that uniqueID to set our item's imageKey
NSString *key= (__bridge NSString *)newUniqueIDString;
_item.imageKey=key;
//Store image in the BNRImageStore with this key
NSLog(@"putting %@ in dictionary table",_item.imageKey);
[[BNRImageStore sharedStore] setImage:image forKey:_item.imageKey];
//Releasing Core-Foundation objects
CFRelease(newUniqueIDString);
CFRelease(newUniqueID);
[imageView setImage:image];
NSLog(@"Dismissing Modal Controller");
[self dismissViewControllerAnimated:YES completion:NULL];
}
여기에 있습니다. NSLog 메시지 imagePicker는이고 세 번째 마지막 줄에는 모달 컨트롤러 해제 중이 콘솔에 표시되지 않습니다. 다시 런타임은 이러한 NSLog 라인을 처리하지 않습니다.
나는이 동작이 매우 이상하다고 생각하기 때문에 잘못된 것이라고 가정합니다. 무슨 일이야?
이것은 파생 된 데이터 문제와 같습니다. 파생 데이터 삭제 및 클린 빌드 수행 –
파생 데이터 란 정확히 무엇입니까 ?? – rahulbsb
특정 폴더의 내용을 삭제해도 안전합니까 ?? 그것은 무엇을 할 것인가? – rahulbsb