tags:

views:

291

answers:

2

I am trying to apply Mike Chen's answer here, using SDK 3.0. In delegate.m file I implement;

[viewController.view addSubview:[[objc_getClass("PLCameraController") sharedInstance] previewView]];

and in viewcontroller.m I implement:

PLCameraController *cam = [objc_getClass("PLCameraController") sharedInstance];
CapturedImage = [cam _createPreviewImage];

but 'cam' is always nil. Any suggestions?

A: 

This won't work when running in the simulator or on an iPod Touch. Are you running this on a physical iPhone with a camera?

Also, if you've dumped the headers correctly, you shouldn't be using the objc_ runtime functions, but rather using the class names. Is the result of objc_getClass("PLCameraController") set to nil?

On a side note: I hope you're not looking to publish your application through the App Store because this sort of private method calling is a great excuse for Apple to reject your application.

Ben S
I am running on a physical iPhone.I have to use objc_getClass otherwise I get:dyld: Symbol not found: _OBJC_CLASS_$_PLCameraControllerReferenced from: /private/var/stash/Applications.pwn/iPhoneCam.app/iPhoneCamExpected in: flat namespaceTrace/BPT traperror
paul simmons
A: 

To use PLCameraController, you'll need to include the PhotoLibray private framework. The simplest way to do that is drag drop an Image Picker Controller (UIImagePickerController) into your main nib.

Arrix