반응형
선언되지 않은 식별자 'kUTTypeMovie'사용
오류 메시지가 나타납니다- 선언되지 않은 식별자 'kUTTypeMovie'사용
아래 코드에서-
-(IBAction)selectVideo:(id)sender {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
}
뭐가 잘못 됐나요?
프레임 워크 MobileCoreServices를 프로젝트에 추가 한 다음 가져와야합니다.
목표 C :
#import <MobileCoreServices/MobileCoreServices.h>
그러면 문제가 사라질 것입니다.
스위프트 4 :
import MobileCoreServices
빠른
import MobileCoreServices
목표 c
#import <MobileCoreServices/MobileCoreServices.h>
저는 iOS 개발 및 xcode의 초보자이며 가져 오기가 작동하지 않는 이유를 찾으려고 시간을 보냈습니다. 경험이 많은 팀원과 함께 문제를 파악한 후
#import <MobileCoreServices/MobileCoreServices.h>
그러나 바이너리를 MobileCoreServices 프레임 워크의 라이브러리에 프로젝트의 빌드 단계에 연결해야합니다.
도움이 되었기를 바랍니다! 이 작업을 할 때이 정보가 필요했습니다.
비디오 카메라 코드 및 imagePicker 델리게이트가 포함 된 Swift 4 답변 :
import MobileCoreServices
비디오 카메라 열기
@IBAction func openVideoCamera(_ sender: Any) {
if UIImagePickerController.isSourceTypeAvailable(.camera) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .camera
imagePicker.mediaTypes = [kUTTypeMovie as String]
imagePicker.videoMaximumDuration = 10 // or whatever you want
imagePicker.videoQuality = .typeMedium
imagePicker.allowsEditing = false
present(imagePicker, animated: true, completion: nil)
}
ImagePicker 대리자 :
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let mediaType = info[UIImagePickerControllerMediaType] as AnyObject
if mediaType as! String == kUTTypeMovie as String {
let videoURL = info[UIImagePickerControllerMediaURL] as? URL
print("VIDEO URL: \(videoURL!)")
}
dismiss(animated: true, completion: nil)
}
- 아직 추가하지 않은 경우 MobileCoreServices.framework를 추가하십시오. 대상을 선택하고 라이브러리와 연결된 바이너리를 추가합니다.
- 더하다
#import <MobileCoreServices/MobileCoreServices.h>
import MobileCoreServices
@import MobileCoreServices;
객관적인 c에 대한 신속한
참고 URL : https://stackoverflow.com/questions/11755494/use-of-undeclared-identifier-kuttypemovie
반응형
'Programming' 카테고리의 다른 글
마지막 자식 선택기 사용 (0) | 2020.08.08 |
---|---|
Java에서 현재 날짜를 문자열로 변환하는 방법은 무엇입니까? (0) | 2020.08.08 |
사전과 해시 테이블의 차이점 (0) | 2020.08.08 |
정의되지 않은 매크로 : AC_MSG_ERROR (0) | 2020.08.08 |
PreferenceScreen에 버튼을 추가하는 방법 (0) | 2020.08.08 |