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

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
Here is my code. It is completely identical to mac's code except for "viewController" replaces apple's "myViewController." I have retyped the full code in all of the files and I arranged the .xib files the same way. For some reason though the mac program doesn't have an error with 'aViewController' but my program does. Like I said everything is identical. Help would be greatly appreciated.

#import "newtry1AppDelegate.h"
#import "newtry1ViewController.h"

@implementation newtry1AppDelegate

@synthesize window;
@synthesize viewController;


- (void)applicationDidFinishLaunching: (UIApplication *)application {

viewController *aViewController = [[viewController alloc] initWithNibName:mad:"newtry1ViewController" bundle:[NSBundle mainBundle]];
//the error is here "error:'aViewController' undeclared (first use in this function)"

self.viewController = aViewController;
[aViewController release];

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];

UIView *controllerView = [viewController view];
[window addSubview:controllerView];
[window makeKeyAndVisible];
}


- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end



thank you to those who try to help me
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I don't know what example you are working off of, but it seems that aViewController should be of type:
NSViewController *
Not viewController * (as i don't think this exists as a type, unless you defined it)

-Lee
 

ElectricSheep

macrumors 6502
Feb 18, 2004
498
4
Wilmington, DE
@synthesize viewController; implies that viewController is a container. viewController *aViewController = [[viewController alloc] ...]; implies that viewController is a type (a class). You can't have it both ways, so which is it? Is viewController a type, or a container?
 

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
I don't know what example you are working off of, but it seems that aViewController should be of type:
NSViewController *
Not viewController * (as i don't think this exists as a type, unless you defined it)

-Lee

The example I am using is the one off of the apple website that has the download for the Iphone SDK. They have sample codes towards the bottom.

about the NSViewController * I'm uncertain as to whether that is right or not. It may be and ill try it, but if you go and look at apple's code it is as i put it.
 

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
@synthesize viewController; implies that viewController is a container. viewController *aViewController = [[viewController alloc] ...]; implies that viewController is a type (a class). You can't have it both ways, so which is it? Is viewController a type, or a container?

It is a class, here is the corresponding header file.

#import <UIKit/UIKit.h>

@class ViewController;

@interface newtry1AppDelegate : NSObject <UIApplicationDelegate> {
IBOutlet UIWindow *window;
IBOutlet ViewController *viewController;
}

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) ViewController *viewController;

@end

If you want I could post Mac's code that they provided for these files.

these are the Delegate files that i am working with by the way
 

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
ok i found something new, they were using upper case and lower case letters for different things with the same name. I corrected my error. Now there seems to be a problem with running it because it likes to quit unexpectedly. Thanks for helping though because you made me think about that when you said it couldn't be both.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
ViewController *
is not the same as:
viewController *

C and Objective-C are case sensitive, they are not like Fortran (thankfully... trying reading 1000s of lines written in all caps).

-Lee
 

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
well at least it runs now, but it isnt exactly doing what I want it to do.

It is supposed to open up, show the origonal MainWindow.xib, and then it should switch to newtry1ViewController.xib. However, it doesn't seem to be switching to the other Nib file.

It either freezes my iphone simulator or it "quits unexpectedly."

Any ideas as to how to fix this?

Sorry I'm new at this and I am supposed to learn it as a job and eventually start writing tutorials for it so I need all of the help that I can get.

Thank you so much for helping!
 

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
OK I gave up on that one and I am rewriting the program and plan on paying better attention to the capitalization. Thank You all for your help and I will be sure to keep in mind what you told me with my problem earlier.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.