Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Phanfare iPhone app has direct camera access?! How?!

Hello,

I'm sure many of you have tried out some of the apps on the AppStore. One app in particular caught my attention because I have no idea how they were able to pull it off.

For the longest time, I've always assumed that the only way we could access the camera was through the UIImagePickerController. This forced everybody to use the built-in view as well as experience the slow saving state of the camera. Others have mentioned in this forum that the image picker is much slower than the native camera app.

But if you take a look at Phanfare, they were somehow able to circumvent the image picker completely and gain access to the camera. Their application seems very fast.

My only guess right now is that they were somehow able to figure out how to strip the built-in view layers off of the image picker.

But when they save the photo, it's also very fast and responsive.

Does anybody have an idea how they were able to do this?

Thanks for your help in advance.

Macbook, Mac OS X (10.5.3)

Posted on Jul 11, 2008 3:56 AM

Reply
29 replies

Jul 15, 2008 3:48 AM in response to eventhough

They must have used the private framework called PhotoLibrary which gives you access to the lower level camera API. I have not found any delays when using this framework. It is not officially made available by Apple and I'm surprised that Apple has allowed an app using it to be in the App store. If you want to use it you'll need the headers from the iphone dev team.

Marc

Jul 15, 2008 8:24 AM in response to kb1ooo

ya, tried to download phanfare this morning. looks like apple pulled it. Unless I'm missing how to use UIImagePickerController properly, it is way too slow (for camera pics) to be useable. I get 2s to preview, then 7s after confirmation. If I use the PhotoLibrary framework, everything is just as snappy as it is with the native camera app. Abt 1.5 to 2s to snap a pic.

Marc

Jul 15, 2008 9:07 AM in response to kb1ooo

a large portion of the 7s can be in your app... i found that getting to the first line of my app code was about 3 or 4 (still waaaay too slow). i also found that processing the photo took a very long time in my app (that is where the other 3 or 4 sec went). when i backgrounded that operation with this call:

[code]
[NSThread detachNewThreadSelector:@selector(backgroundSaveImageHolder:) toTarget:self withObject:theImage];
[code]

i got much much better results... but then i had all the pain of syncing back up the threads on the other end and making sure all the releases and retains were in the right place.

Jul 15, 2008 10:02 AM in response to jdheard

You're right, Phanfare is no longer available into the AppStore. But I try another app yesterday that has direct camera access: "SnapMyLife". It works nice on my iPhone (1st gen, upgraded with FW2.0). It seems to be always available into the AppStore at this time.

I'm very interested to know if some kind of private agreement with Apple exists to get access to an "extended SDK". IMHO it's the only way to use the official SDK for 2.0 FW with PrivateFrameworks like the PhotoLibrary. I cannot figure out how to use the dev-team headers with the new firmware. The modified version of the "class-dump" utility seems doesn't work anymore...

Anyone from Apple reading this ?

Jul 15, 2008 10:34 AM in response to xoumi

xoumi,

I don't know what you mean. I just downloaded snapmylife and it uses the uiimagepickercontroller interface? It even actually takes longer to get to the preview (abt 3-4s) and crashes when hitting "use photo".

I've had no problems using the headers provided by the dev team with the latest SDK. Just follow the instructions carefully on their wikee.

Marc

Jul 15, 2008 10:43 AM in response to johne-dm

johne-dm,

I'm not sure how I could be hogging anything in my app. The app just has a tab bar with 2 tabs. Click on the camera tab and it launches the uiimagepicker modal view. The delegate just dismisses the modal view and adds the image to the tab item's view.

Can you be more specific abt how you optimized you app, and the performance enhancement?

Tnx,
Marc

Jul 15, 2008 11:27 AM in response to kb1ooo

well... you can put in some log statements at the beginning of your image handler method and at the end with timing info:


NSLog(@"pick start:%f", [[NSDate date]timeIntervalSinceReferenceDate]);
// do your work here
NSLog(@"pick end:%f", [[NSDate date]timeIntervalSinceReferenceDate]);


the numbers you see will be in seconds (with fractions of seconds as the decimal protion).

you can then look at the debug console and see if it is taking up alot of time in there. i found that just setting a UIImageView image property didn't take long at all, but trying to do anything with the image like save it, turn it into a jpg, scale it, etc, etc takes several seconds.

Jul 15, 2008 3:24 PM in response to jdheard

Hi all, the Phanfare app is currently not downloadable the app store (you can search for the app but not download it). We have contacted Apple and are waiting to hear back. Note that the camera framework we used was documented in a book by O'Reilly. We definitely did not get any headers from Apple or reverse engineer anything.

We are not sure why the app was removed. The camera controller we used lets us offer a much better experience to users (faster) and a workflow that makes sense to us. But obviously if Apple does not want us to use it and requires that we use the slower control, we will do so. We certainly want the app back in the store. Our reviews have been strong. We are also huge supporters of Apple (see http://blog.phanfare.com)

It may just be a glitch. We don't know any more than you do on this unfortunately.

Andrew Erlichson
CEO
Phanfare, Inc.

Jul 15, 2008 3:57 PM in response to applephan

Andrew,

Could you please offer us a tip on how you were able to access the camera directly? As of right now, it seems like every single app on the store is using the UIImagePicker except Phanfare. Even Facebook uses the UIImagePicker. All of us are wondering how it can be done.

We understand you wish to protect your proprietary code, but this is not something that will "make or break" your application. Letting us know will help the entire community and make the iPhone an even better experience for all users. Please consider helping us out a little bit and giving back to the community.

If Phanfare does not violate any terms of service, it should be okay for you to let us know how it was done.

Thanks

Jul 15, 2008 5:27 PM in response to eventhough

eventhough,

Sample code has been all over the internet for almost a year. You need the PhotoLibrary classes, in particular CameraController. Do a search at code.google.com for iflickr as an example. Also visit the forums at idevdocs.com. You'll need the headers which you can get from the iphone dev team. Just do a google search for iphone dev team.

Marc

Jul 15, 2008 5:54 PM in response to kb1ooo

Marc,

Thanks for your response. I understand how to do it by accessing the private PhotoLibrary class, but Phanfare claims they are doing it without breaking any rules. If they managed to get their app approved by Apple without breaking any rules, I'd like to know how.

If they are breaking rules, it should only be fair that all of us are allowed to do it.

I don't want to get my app banned because I compiled my own headers created by the dev team.


http://www.onlamp.com/pub/a/onlamp/2008/03/25/the-apple-sdk-apis-apple-didnt-wan t-you-to-know-about.html


Thanks

Phanfare iPhone app has direct camera access?! How?!

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.