Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikemanblah

macrumors regular
Original poster
Jul 15, 2009
214
0
What is the code to turn the iphone 4 camera flash on?

Also what does this error mean

error: expected specifier-qualifier-list before '@' token
 

mikemanblah

macrumors regular
Original poster
Jul 15, 2009
214
0
I dont have anything else written in before it, Its a fresh slate with one line of code
 

mikemanblah

macrumors regular
Original poster
Jul 15, 2009
214
0
I'm getting this

Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIImagePickerController.h>

@interface Mainview : UIResponder {
UIImagePickerControllerCameraFlashModeOn   = 1 
(: error: expected specifier-qualifier-list before 'UIImagePickerControllerCameraFlashModeOn')



	
};
typedef NSInteger UIImagePickerControllerCameraFlashMode;
@end
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,425
A sea of green
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIImagePickerController.h>

@interface Mainview : UIResponder {
UIImagePickerControllerCameraFlashModeOn = 1
:) error: expected specifier-qualifier-list before 'UIImagePickerControllerCameraFlashModeOn')




};
typedef NSInteger UIImagePickerControllerCameraFlashMode;
@end

You need a typename before UIImagePickerControllerCameraFlashModeOn.

If you intend to use UIImagePickerControllerCameraFlashMode as the type of UIImagePickerControllerCameraFlashModeOn, then you need to place it before the typedef is used. C and Objective-C don't support deferred definitions of any types. The typename must be defined before the point of its first use.

Also, the names you're using have already been defined:
http://developer.apple.com/iphone/l.../c_ref/UIImagePickerControllerCameraFlashMode

I get the feeling you don't know how to use enum types.
 

mikemanblah

macrumors regular
Original poster
Jul 15, 2009
214
0
I'm 13 and i'm just starting out. What would i type instead? Thanks for all the help
 

firewood

macrumors G3
Jul 29, 2003
8,108
1,345
Silicon Valley
I'm gonna suggest instead that it's time to step away from the real coding and go learn the basics of Objective-C.

Or plain C, since that's where Obj C gets its types and type syntax from, plus there are a ton more books available on learning C, probably at your local library for free.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,425
A sea of green
I'm 13 and i'm just starting out. What would i type instead? Thanks for all the help

No one knows what you'd type instead. You haven't explained what you want to do. No one can write code effectively without knowing what it's expected to do.

In any case, if you have to ask what to type, then you're probably not ready to type any code. You need to do more reading. You can't sit down in the cockpit of a fighter jet and expect to fly it without some training.

We can't read your mind. We can't see your screen. All we know about you and your work is what you tell us in this forum.

If you haven't told us what book or tutorial you're using, then you can't expect advice on a better one. If you're not using a book or tutorial, there are stickies at the top of this forum you should read.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,425
A sea of green
Well imma go reading up. I was trying to turn the flash on

Yes, that was obvious. What's not so obvious is the larger context of what you're trying to do.

The UIImagePickerControllerCameraFlashMode type, and its 3 values (off, on, and auto) are used to specify how the flash behaves when taking a picture with the camera. But you asked in another thread about how to turn on the flash LED to use it as "not a flashlight", which is a completely different thing than using it with the camera.
https://forums.macrumors.com/threads/962403/

So you're still not really explaining what you want to do in a way that someone can give useful suggestions.

Other things that aren't obvious are the extent of your programming experience, and exactly what you're reading that you hope will teach you how to make a flashlight using the LED.
 

mikemanblah

macrumors regular
Original poster
Jul 15, 2009
214
0
Just so i can have a test project, whats the iphone documentation page for the led flash that does not require opening of the camera app
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.