tags:

views:

123

answers:

1

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:

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

but CapturedImage is always nil. Any suggestions?

A: 

Things to check:

(1) Has PLCameraController been updated for iPhone 3.x? This blog post suggest it has not.

(2) Instead of nesting all your calls Smalltalk style break them apart so you can see if your getting the objects you think you are:

WhateverClass *cameraController=[objc_getClass("PLCameraController") sharedInstance];
if (cameraController!=nil) {
 ImageClass *myImage=[cameraController _createPreviewImage];
}else {
 NSLog(@"camerController is nil");
}

Just remember that PLCameraController is a private framework that relies on a hidden Apple API. Even if you get it work, you most likely won't get it passed the App store review.

TechZen