[英]to access camera view and capture image in ios5 which framework is used?
Before ios 5 AVFoundationFramework is used but it is not working with ios5 storyboard Application gives linking errors like even if i add the framework Please help me. 之前使用ios 5 AVFoundationFramework但它不能与ios5 storyboard应用程序提供链接错误,即使我添加框架请帮助我。
Below given method gives me top 3 or 4 errors. 下面给出的方法给出了前3或4个错误。
- (id) init
{
self = [super init];
if (self != nil) {
void (^deviceConnectedBlock)(NSNotification *) = ^(NSNotification *notification) {
AVCaptureDevice *device = [notification object];
BOOL sessionHasDeviceWithMatchingMediaType = NO;
NSString *deviceMediaType = nil;
if ([device hasMediaType:AVMediaTypeAudio])
deviceMediaType = AVMediaTypeAudio;
else if ([device hasMediaType:AVMediaTypeVideo])
deviceMediaType = AVMediaTypeVideo;
if (deviceMediaType != nil) {
for (AVCaptureDeviceInput *input in [session inputs])
{
if ([[input device] hasMediaType:deviceMediaType]) {
sessionHasDeviceWithMatchingMediaType = YES;
break;
}
}
if (!sessionHasDeviceWithMatchingMediaType) {
NSError *error;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if ([session canAddInput:input])
[session addInput:input];
}
}
if ([delegate respondsToSelector:@selector(captureManagerDeviceConfigurationChanged:)]) {
[delegate captureManagerDeviceConfigurationChanged:self];
}
};
void (^deviceDisconnectedBlock)(NSNotification *) = ^(NSNotification *notification) {
if ([delegate respondsToSelector:@selector(captureManagerDeviceConfigurationChanged:)]) {
[delegate captureManagerDeviceConfigurationChanged:self];
}
};
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[self setDeviceConnectedObserver:[notificationCenter addObserverForName:AVCaptureDeviceWasConnectedNotification object:nil queue:nil usingBlock:deviceConnectedBlock]];
[self setDeviceDisconnectedObserver:[notificationCenter addObserverForName:AVCaptureDeviceWasDisconnectedNotification object:nil queue:nil usingBlock:deviceDisconnectedBlock]];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[notificationCenter addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil];
orientation = AVCaptureVideoOrientationPortrait;
}
return self;
}
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AVCaptureDeviceInput", referenced from:
objc-class-ref in AVCamCaptureManager.o
"_OBJC_CLASS_$_AVCaptureStillImageOutput", referenced from:
objc-class-ref in AVCamCaptureManager.o
"_OBJC_CLASS_$_AVCaptureSession", referenced from:
objc-class-ref in AVCamCaptureManager.o
"_OBJC_CLASS_$_AVCaptureDevice", referenced from:
objc-class-ref in AVCamCaptureManager.o
"_AVCaptureDeviceWasConnectedNotification", referenced from:
-[AVCamCaptureManager init] in AVCamCaptureManager.o
"_AVCaptureDeviceWasDisconnectedNotification", referenced from:
-[AVCamCaptureManager init] in AVCamCaptureManager.o
"_AVMediaTypeAudio", referenced from:
___27-[AVCamCaptureManager init]_block_invoke_0 in AVCamCaptureManager.o
-[AVCamCaptureManager micCount] in AVCamCaptureManager.o
-[AVCamCaptureManager(InternalUtilityMethods) audioDevice] in AVCamCaptureManager.o
"_AVMediaTypeVideo", referenced from:
___27-[AVCamCaptureManager init]_block_invoke_0 in AVCamCaptureManager.o
-[AVCamCaptureManager captureStillImage] in AVCamCaptureManager.o
-[AVCamCaptureManager cameraCount] in AVCamCaptureManager.o
-[AVCamCaptureManager(InternalUtilityMethods) cameraWithPosition:] in AVCamCaptureManager.o
-[AVCamViewController(InternalMethods) convertToPointOfInterestFromViewCoordinates:] in AVCamViewController.o
___27-[AVCamCaptureManager init]_block_invoke_0 in AVCamCaptureManager.o
-[AVCamCaptureManager captureStillImage] in AVCamCaptureManager.o
-[AVCamCaptureManager cameraCount] in AVCamCaptureManager.o
-[AVCamCaptureManager(InternalUtilityMethods) cameraWithPosition:] in AVCamCaptureManager.o
-[AVCamViewController(InternalMethods) convertToPointOfInterestFromViewCoordinates:] in AVCamViewController.o
"_AVVideoCodecJPEG", referenced from:
-[AVCamCaptureManager setupSession] in AVCamCaptureManager.o
"_AVVideoCodecKey", referenced from:
-[AVCamCaptureManager setupSession] in AVCamCaptureManager.o
"_CMVideoFormatDescriptionGetCleanAperture", referenced from:
-[AVCamViewController(InternalMethods) convertToPointOfInterestFromViewCoordinates:] in AVCamViewController.o
"_OBJC_CLASS_$_AVCaptureVideoPreviewLayer", referenced from:
objc-class-ref in AVCamViewController.o
"_AVLayerVideoGravityResize", referenced from:
-[AVCamViewController(InternalMethods) convertToPointOfInterestFromViewCoordinates:] in AVCamViewController.o
"_AVLayerVideoGravityResizeAspect", referenced from:
-[AVCamViewController(InternalMethods) convertToPointOfInterestFromViewCoordinates:] in AVCamViewController.o
"_AVLayerVideoGravityResizeAspectFill", referenced from:
-[AVCamViewController viewDidLoad] in AVCamViewController.o
-[AVCamViewController(InternalMethods) convertToPointOfInterestFromViewCoordinates:] in AVCamViewController.o
"_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
objc-class-ref in ImageViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks in advance EDIT: Problem is solved. 在此先感谢编辑:问题解决了。 some changes in app settings like change in search header path etc.
应用设置中的一些更改,例如搜索标题路径中的更改等
To me: 对我来说:
Simply add AVFoundation Framework to Linked FrameWork and Libraries in Target tab. 只需将AVFoundation Framework添加到Target选项卡中的Linked FrameWork和Libraries即可。
但对我来说, CoreMedia.framework
和AVFoundation.framework
一起帮助了。
please add . 请加 。 the following frame works into your project and import in target class
以下框架适用于您的项目并导入目标类
<AssetsLibrary/AssetsLibrary.h>
<AVFoundation/AVFoundation.h>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.