I am trying to take a picture from my iPad app, using code I have found on the internet. I have this method:
- (BOOL) startCameraControllerFromViewController: (UIViewController*) controller
usingDelegate: (id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate {
in a file called CameraViewController.m.
In CameraViewController.h, I have this definition:
@interface CameraViewController : UIViewController
+ (BOOL) startCameraControllerFromViewController: (UIViewController*) controller
usingDelegate: (id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate;
@end
I am trying to call it from this method which is in ClientSetupViewController.m:
- (void) captureImage {
[startCameraControllerFromViewController: self usingDelegate: self];
}
I’m getting an error saying
Use of undeclared identifier startCameraControllerFromViewController
I have #import “CameraViewController.h” in CLientViewController.h
I’m totall lost! I thought I had everything defined correctly, but I guess not. What is wrong with my code?
UPDATE: getting this error now after changing code to call instance:
Undefined symbols for architecture armv7:
“_OBJC_CLASS_$_CameraViewController”, referenced from:
objc-class-ref in ClientSetupViewController.o
anon in CameraViewController.o
l_OBJC_$_CATEGORY_CameraViewController_$_CameraDelegateMethods in CameraViewController.o ld: symbol(s) not found for architecture
armv7 clang: error: linker command failed with exit code 1 (use -v to
see invocation)
If
startCameraControllerFromViewController:usingDelegate:is indeed a class function (as indicated by the +), then the way to call the function would be:[CameraViewController startCameraControllerFromViewController: self usingDelegate: self]A message is sent to an object, or a class. In your code, you have just the message name in the message call
[ ], with no indication of where this message should be sent to.