Benches iPhone

2

[iPhone SDK] NSIvalidArgumentException: S…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Gah! Please, someone, help!

I'm getting some type of "NSInvalidArgumentException: Source type 1 not available" error in the debugger. I've spent hours googling and looking through documentation, and I can't find anything on this. So, quick description on how to recreate the problem...

1. Well, I started off with a generic Tab Bar Application from the iPhone OS > Application menu in the New Project window.

2. In Interface Builder, on one of the UIViewControllers, I added a UIView as a subitem, which itself has an UIImageView and UIButton as subitems. So far, so good. Compiles and stuff.

3. At this point, I imported a CameraTestViewController class from another project, which is a subclass of UIViewController. Imported the .h, .m, and .xib files. In the other project, this camera test controller works just fine, but it gets launched from the AppDelegate. I want to be able to call it from a Tab Bar, however; so, I've started this new project, and am importing this control over. Here is the code:

#import "CameraTestViewController.h"

@implementation CameraTestViewController

@synthesize imgPicker;

- (void)viewDidLoad {

self.imgPicker = [[UIImagePickerController alloc] init];

self.imgPicker.allowsImageEditing = YES;

//self.imgPicker.delegate = self;

self.imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;

}

- (IBAction)grabImage {

[ self presentModalViewController:self.imgPicker animated:YES ] ;

}

- (void)imagePickerController:(UIImagePickerController *)picker

didFinishPickingImage:(UIImage *)img

editingInfo:(NSDictionary *)editInfo {

image.image = img;

[ [ picker parentViewController ] dismissModalViewControllerAnimated:YES ] ;

}

@end

#import <UIKit/UIKit.h>

#import <Foundation/Foundation.h>

@interface CameraTestViewController : UIViewController {

IBOutlet UIButton *button;

IBOutlet UIImageView *image;

UIImagePickerController *imgPicker;

}

- (IBAction)grabImage;

@property(nonatomic, retain) UIImagePickerController *imgPicker;

@end

4. I made sure to rename both the Class and NIB files to CameraTestViewController. At this point, the Interface Builder looks like this:

User uploaded file

And this is when things start breaking down. When I compile, nothing happens, and I get the following accursed 'Source type 1 note available' error in the debugger, which is driving me up the wall.

[Session started at 2008-09-21 00:16:53 -0400.]

2008-09-21 00:16:54.778 TabBarTest [2802:20b]
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available'

2008-09-21 00:16:54.779 TabBarTest [2802:20b] Stack: (

2424762699,

2425093691,

817871197,

10129,

818069166,

818076920,

816177049,

816209730,

2435012078,

2424265541,

2424265976,

829005112,

829005309,

816175835,

816221412,

9420,

9274

)

As far as I can tell, this error doesn't exist anywhere else on the entire Internet, except for
my computer, of course. Did I forget to install something? Does my dear MacBook not have source type 1? Where can I get source type 1?
What is source type 1??? Inquiring minds would like to know!

At any rate, it seems that it's either something wrong with my code, or something wrong with my computer. And in the case it's something wrong with
my setup, here is some info on what I'm running:

Hardware Overview:

Model Name: MacBook Pro

Model Identifier: MacBookPro3,1

Processor Name: Intel Core 2 Duo

Processor Speed: 2.4 GHz

Number Of Processors: 1

Total Number Of Cores: 2

L2 Cache: 4 MB

Memory: 4 GB

Bus Speed: 800 MHz

And some info on my compiler:

User uploaded file

Anyhow. If anybody can help me out with this infernal error, I would be soooo grateful. I'm at the point where I'm considering the possibility that this error could be the result of either gremlins causing mischief or a depressed computer that's sulking. I'd really rather not have to call in an exorcist or a psychotherapist.

Thanks in advanced!

abigail

2 replies

Sign in or join Beachball Help to reply.

  1. 0

    bryanwoods

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I'm having the exact same issue.

    I'm glad to see you're attempting to use the camera too, as I suspect that to be the culprit.

    Any luck since you posted this error?

  2. 0

    KiyoshiKyokai

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hey, I've encountered this error as well--the solution is disparagingly simple. The culprit line is:

    self.imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;

    This source type, whose value is 1, is unavailable when building in simulator mode. Build in device mode and it should run fine.